home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 117 / MacAddict 117.dmg / Software / Internet & Communication / Snak 5.1 (shareware).dmg / Snak.app / Contents / Resources / Scripts / purepak.irc < prev    next >
Text File  |  2005-08-04  |  87KB  |  2,643 lines

  1.  
  2. # Snak adaptation 1.1. Removed handlers that emit conflicting messages and usually made '-'
  3. # Snak adaptation 1.2. Removed unnecessary checks for the correctness of ischanop
  4. # Snak adaptation 1.3. Removed pp.snm and calls to it as Snak does integrated highlighting
  5. # Snak adaptation 1.4. Removed pp.formecho in priv msg and notice handlers as it conflicts with normal message formatting
  6. #                       Removed //who when joining channel and message formatting in /who handler
  7. #                       Removed handlers for mesages 432 and 433 as Snak already does this
  8. #                       Removed message in notify_signon, and made it let Snak continue processing
  9. #                       Change order of handler and exec because execs are handled directly - not handed to the OS
  10. #                       The wait -CMD %<process> returns immediately as true
  11. #                       Removed CTCP handlers for ping, version, finger as Snak already does this
  12. #                       Modified dcc.ucmd.offer so that it asks properly for one or more files
  13. #                       dcc.ucmd.offer uses a variation on /input which asks for files
  14. #                       Because Mac files can contain spaces, the resulting list is separated by tabs, so 
  15. #                       a new function "listitem" is used instead of "word"
  16. #                      Removed fileexist from pp-dcc.irc alias and made a built in function
  17. #                       "Press ENTER to continue" in doechos removed..Snak can scoll.
  18. #                       /dcc save <file> saves package file in the scripts directory
  19. #                       /dcc notice now only sends to the current channel, not all channels.
  20. # Snak adaptation 1.5  the fileserver (/pphelp dcc) now works. Most changes consists of using listitem instead of word
  21. # Snak adaptation 1.6  Snak does its own DCC Autoaccept
  22. #                        Furthermore, the purepak dcc code does not always work because it assumes that there are no spaces 
  23. #                      in the filename. If there is then $6 will be incorrect and the script fails.
  24. # Snak adaptation 1.7  added special "window log_extrainfo off" flag to window creation so that Snaks text logger will
  25. #                       not write "server:" or "info:" before each line. This affects /sve and /dcc.ucmd.save
  26. #                       Removed Purepak 333 topic intercept as it interferes with Snak topic handling
  27. #                       Removed unnecessary (and incorrect) PurePak redefinition of the say alias
  28. # Snak adaptation 1.8  Snak will PING itself every 90 seconds if there is no traffic, so disable the purepak on raw handler
  29. #                       that listens for PONG
  30. # Snak adaptation 1.9  Remove signoff handler
  31. # Snak adaptation 1.10 Removed all places that used the PP.USERS. The maintenance of a separate list of users by the script made 
  32. #                       it impossible to use PurePak on a large channel (500-1000) users. It was only used for fmdop (fast mass deop) and users.
  33. #                       If there is any demand, I will reimplement fmdop and users in the program itself. users if useful for finding channel members with a particular host mask.
  34. # Snak adaptation 1.11 Make sve function use the new rm, mkdir, write and close functions. remove unnecesary rm alias in pp.
  35. #                       Make PP store its settings files in a subdirectory in the home directory. removed unused load_path
  36. #                      Removed unnecessary load overrive which supported compressed files
  37. #                       Removed unnecessary duplication of the notify list
  38. #                       Removed unflash, mail and uumail. Not relevant on a Mac
  39. #                       Removed many of the variables that purepak sets up. They were used in the original ircII client but have no effect in Snak.
  40. #                       Removed references to beep_on_msg. Snak doesn't use that.
  41. #                       The pp.savedfrom function is not necessary, but it is left present since it is called when loading a settings file.
  42. #                       Removed the repeatcmd function. It was a duplicate of a command in the basical script file which is always loaded. 
  43. #                       Disabled the automatic loading of pp-bots. DCC Raw is not supported.
  44. #                       sendto now uses say with a -t parameter so that the ascii art output looks better
  45. #                       Took out the tabkey message history. Snak already has this built it.
  46. #                       Removed the getuh alias. Snak 5 contains getuh as a built in function so that PP can access the userhost directly without h
  47. #                           having to maintain the UHOSTCACHE 
  48. #                       Fixed minor bug in the /avoid command where it would not detect if a nick was already on the avoid list
  49. #                       Removed setmformat. Snak controls the message format through user preferences.
  50. #                       Removed the setting of number of lines in the display. Snak can scroll.
  51. #                       Removed the paging system in pp.pauseset, pp.pauseend and pp.doechos. Snak scrolls just fine.
  52. #                       Disabled the automatic nslookup
  53. #                       Removed logging to a file while away. Snak can scroll.
  54. #                        
  55. # To automatically load this into a connection, add "/load purepak.irc" to the startup actions.
  56. #
  57. # ########################################################################## #
  58. #                      PurePak - The sequel to TextBox                       #
  59. #                          A -+ TEXT +- production                           #
  60. # ########################################################################## #
  61. # Author: Crypt Keeper [ckeeper@axiom.access.one.net] (CKeeper on IRC)
  62. # Version 2.07
  63. #
  64. # This script requires at least ircII2.2.9 (Unix) or a fully ircII compatible
  65. # client.  It has only been tested under Unix with ircII2.2.9 and ircII2.8.2.
  66. #
  67. # If you edit this file, you must edit it with a Unix text editor or use
  68. # utilities like dos2unix/unix2dos to convert it to DOS to edit and then
  69. # back to Unix.  If it is edited in a DOS text editor it will be corrupted.
  70. #
  71. # All stolen code is labelled.  If it isn't labelled as stolen code, then it
  72. # is mine.  If you take my code, please give me credit.
  73. #
  74. # PurePak version 2.07 IRC script
  75. # Copyright (C) 1995
  76. #
  77. # This program is free software; you can redistribute it and/or modify
  78. # it under the terms of the GNU General Public License as published by
  79. # the Free Software Foundation; either version 1, or (at your option)
  80. # any later version.
  81. #
  82. # This program is distributed in the hope that it will be useful,
  83. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  84. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  85. # GNU General Public License for more details.
  86. #
  87. # You should have received a copy of the GNU General Public License
  88. # along with this program; if not, write to the Free Software
  89. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  90. # ########################################################################## #
  91.  
  92. @ PPVERS = [2.07]
  93.  
  94. # ----------------------------------------------------------------------------
  95. # Sets and key bindings
  96. # ----------------------------------------------------------------------------
  97.  
  98. # See if we're on an EPIC client
  99. EVAL ^if (match(*EPIC* $status_user)) {@ PP.EPIC = 1}
  100.  
  101. ^set tab on
  102. ^set tab_max 6
  103. ^set status_user [Lag ??] [PurePak] *
  104. ^set status_mode  (+%+)
  105. ^set debug 0
  106. ^set lastlog 16384
  107. ^set suppress_server_motd off
  108. ^set log off
  109. ^set logfile irc.log
  110. ^set no_ctcp_flood on
  111. ^set flood_warning off
  112. ^set flood_rate 1
  113. ^set flood_after 4
  114. ^set flood_users 4
  115. #^EVAL ^set load_path ~/purepak:./purepak:~:$load_path
  116.  
  117.  
  118. # File that settings are saved to
  119. @ PP.SAVEFILE = [purepak.sav]
  120.  
  121. on ^dcc_raw * {}
  122.  
  123.  
  124. # ----------------------------------------------------------------------------
  125. # Miscellaneous functions and aliases, mostly internal
  126. # ----------------------------------------------------------------------------
  127. # the -t parameter is the intended taget of the message. It can be a channel (with #) or a nick.
  128. alias sendto {
  129.     say -t $0 $1-
  130. }
  131.  
  132. alias nickonly {@ FUNCTION_RETURN = left($index(! $0) $0)}
  133. alias safestr {@ FUNCTION_RETURN = strip(\;\$ $*)}
  134.  
  135. # Returns 1 if you have ops on $0, 0 if you don't.  
  136. alias gotops {
  137.     @ FUNCTION_RETURN = 0
  138.     if ([$0] == C) {^if (P == [@]) {@ FUNCTION_RETURN = 1}}
  139.     {^if (ischanop($N $0)) {@ FUNCTION_RETURN = 1}}
  140. }
  141.  
  142. # Returns a random letter/number string
  143. @ PP.RC = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789a]
  144. alias randcrap {
  145.     @ RC = 1
  146.     while (RC < [$0])
  147.     {
  148.         @ RC = RC + 1
  149.         @ RS = mid($rand(62) 1 $PP.RC)##RS
  150.     }
  151.     @ RS = mid($rand(25) 1 $PP.RC)##RS
  152.     @ FUNCTION_RETURN = RS
  153.     ^assign -RS
  154.     ^assign -RC
  155. }
  156.  
  157. # Returns true if a string contains letters
  158. alias isalpha {
  159.     if (rmatch($0 *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z*)) {@ FUNCTION_RETURN = 1}
  160.     {@ FUNCTION_RETURN = 0}
  161. }
  162.  
  163. # delword <word> <list> (output returned in NLIST)
  164. # recursive alias that deletes a word from a list
  165. alias delword {
  166.     if ([$1] != [$0]) {^assign NLIST $1 $NLIST}
  167.     if ([$2]) {^delword $0 $2-}
  168. }
  169.  
  170. # Check is user is friended/shitted
  171. # ispal/isshit <n!u@h> <#channel>
  172. alias ispal {
  173.     @ FUNCTION_RETURN = 0
  174.     foreach PP.FRIENDS XZ {
  175.         if (match($decode($XZ) $1))
  176.         {
  177.             if (rmatch($0 $PP.FRIENDS[$XZ])) {@ FUNCTION_RETURN = 1}
  178.         }
  179.     }
  180.     ^assign -XZ
  181. }
  182. alias isshit {
  183.     @ FUNCTION_RETURN = 0
  184.     foreach PP.ENEMIES XZ {
  185.         if (match($decode($XZ) $1))
  186.         {
  187.             if (rmatch($0 $PP.ENEMIES[$XZ])) {@ FUNCTION_RETURN = 1}
  188.         }
  189.     }
  190.     ^assign -XZ
  191. }
  192.  
  193. # ----------------------------------------------------------------------------
  194. # Default settings if purepak.sav doesn't exist
  195. # ----------------------------------------------------------------------------
  196.  
  197. # Letters in main settings variable (PP.SET): (this variable is about full)
  198. #   I - Auto-ignore on msg/notice/ctcp floods
  199. #   F - Flood filtering
  200. #   A - Ascii art kicker
  201. #   N - Nick flood protection
  202. #   E - Use enemies list
  203. #   L - Use friends list
  204. #   O - Let everyone know when you are set away
  205. #   W - Send notices and/or warnings to people
  206. #   J - Auto rejoin on kick
  207. #   M - Mass deop/kick protection
  208. #   K - Channel key flash protection
  209. #   B - Ban protection
  210. #   X - Ignore CTCP PING
  211. #   Y - Ignore CTCP VERSION
  212. #   Z - Ignore CTCP FINGER
  213. #   S - Automatic deop on server ops
  214. #   C - Clonebot mass-join protection
  215. #   P - Auto-unload help
  216. #   V - Desynched user notification
  217. @ PP.SET = [CGFENLOWJMKBZPV]
  218.  
  219. # Response to mass deop/kick (0 = deop, 1 = kick)
  220. @ PP.SET.MASSRESP = 0
  221. # Auto-ignoring - number of seconds to autoignore
  222. @ PP.SET.IGSECS = 30
  223. # Short kill notice displays
  224. @ PP.SET.SHORTKILLS = 1
  225. # Server notice settings
  226. @ PP.SET.NOTELEVELS = [KUFNMC]
  227. # Nick flood protection sensitivity
  228. @ PP.SET.NFSENS = 3
  229. # Length of the first word in a message for it to be a junkflood
  230. @ PP.SET.JFLEN = 200
  231. # Exec commands to do various things
  232. @ PP.SET.FINGERCMD = [finger]
  233. @ PP.SET.LSCMD = [ls -l]
  234. @ PP.SET.LSWCMD = [ls -xp]
  235. #@ PP.SET.RMCMD = [rm -f]
  236. @ PP.SET.CATCMD = [cat]
  237. @ PP.SET.PSCMD = [ps -uxw]
  238. @ PP.SET.KILLCMD = [kill -KILL]
  239. #@ PP.SET.NSLOOKCMD = [host]
  240. # Counter variable for awaylog
  241. @ PP.AWAYLCTR = 0
  242. # Minutes of idle-time to be set auto-away (0 disables)
  243. @ PP.SET.AUTOAWAY = 0
  244. # Clonebot mass-join sensitivity (number that must join in a 4 second span
  245. @ PP.SET.CPSENS = 3
  246. # NSLOOKUP on join for IP addresses
  247. #@ PP.SET.LOOKJOIN = 1
  248. # Counter for clonebot mass-join detector
  249. @ PP.CPCTR = 0
  250. # Scripts we should auto-load:
  251. # K = Kicks, X = DCC, B = Bots, S = Silly, W = War
  252. @ PP.SET.AUTOLOAD = [KXS]
  253. # This is set to 1 after the first motd is seen
  254. @ PP.SEENMOTD = 0
  255. # Msg/notice formats
  256. @ PP.SET.MRFORMAT = encode([N!U] M)
  257. @ PP.SET.NRFORMAT = encode(-N- M)
  258. @ PP.SET.MSFORMAT = encode(-> [N] M)
  259. @ PP.SET.NSFORMAT = encode(-> -N- M)
  260. # Channel protection
  261. @ PP.SET.CHANPROT = 1
  262. # Show people as they signoff in splits
  263. @ PP.SET.SHOWSPLITTERS = 0
  264. # Suppress startup messages
  265. @ PP.SET.NOSTARTUP = 0
  266. # Insert random ?'s into bans
  267. @ PP.SET.FUNKYBANS = 1
  268. # Beep on netsplits
  269. @ PP.SET.BSP = 1
  270. # Allow CTCP PAGE
  271. @ PP.SET.CTCPPAGE = 1
  272. # Print time every 10 minutes
  273. @ PP.SET.TP = 0
  274.  
  275. # ----------------------------------------------------------------------------
  276. # /pp alias to set script options
  277. # ----------------------------------------------------------------------------
  278.  
  279. # Other script parts (the pp-*.irc scripts) can add to this array and have
  280. # their settings under /pp
  281. @ PP.SETCHECKS.M = [^pp.set.m]
  282.  
  283. alias pp.set.bstatus {^if ([$0]) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  284. alias pp.set.tstatus {^if (index($0 $PP.SET) >= 0) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  285. alias pp.set.changetoggle {
  286.     if ([$1])
  287.     {
  288.         if ([$1] == [OFF]) {@ PP.SET = strip($0 $PP.SET)}
  289.         {^if (index($0 $PP.SET) < 0) {@ PP.SET = [$0]##PP.SET}}
  290.     }
  291. }
  292. # Snak adaptation 1.4. Snak already handles this
  293. alias pp.set.setupctcp {
  294. #    if (index(X $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**PING**"} {^on ^raw_irc "% PRIVMSG % :**PING**" {}}
  295. #    if (index(Y $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**VER**"} {^on ^raw_irc "% PRIVMSG % :**VER**" {}}
  296. #    if (index(Z $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**FINGER**"} {^on ^raw_irc "% PRIVMSG % :**FINGER**" {}}
  297. }
  298. alias pp.set.onoff {^if ([$0]) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  299.  
  300. alias status {
  301.     echo -- Current PurePak settings and their corresponding abbreviations. 
  302.     echo -- Type /pp <abbreviation> <new value> to change a setting. 
  303.     echo -- Type /sve to save the changed settings.
  304.     echo -- ===========================================================================
  305.     echo -- Automatic flood ignoring (AIGnore)                      : $pp.set.tstatus(I)
  306.     echo -- Filtering of known floods (FFILTer)                     : $pp.set.tstatus(F)
  307.     echo -- ASCII art kicker (ARTKick)                              : $pp.set.tstatus(A)
  308.     echo -- Kicking on kick flood (NFProt)                          : $pp.set.tstatus(N)
  309.     echo -- Use of enemies list (ENEMies)                           : $pp.set.tstatus(E)
  310.     echo -- Use of friends list (FRIends)                           : $pp.set.tstatus(L)
  311.     echo -- Public announcement of away status (AWAYNotices)        : $pp.set.tstatus(O)
  312.     echo -- Logging of msgs/events while away (AWAYLogging)         : $pp.set.tstatus(G)
  313.     echo -- General miscellaneous warnings/notices (NOTIces)        : $pp.set.tstatus(W)
  314.     echo -- Automatic rejoining on kick (KREJoin)                   : $pp.set.tstatus(J)
  315.     echo -- Mass deop/kick protection (MASSProt)                    : $pp.set.tstatus(M)
  316.     if (PP.SET.MASSRESP) {
  317.     echo -- Action taken on mass deop/kick (MASSAction)             : KICK
  318.     } {
  319.     echo -- Action taken on mass deop/kick (MASSAction)             : DEOP
  320.     }
  321.     echo -- Channel protection (CHANprot)                           : $pp.set.onoff($PP.SET.CHANPROT)
  322.     echo -- Automatic removal of server ops (SERVOP)                : $pp.set.tstatus(S)
  323.     echo -- Channel key flash protection (KEYProt)                  : $pp.set.tstatus(K)
  324.     echo -- Ban defense (BANDefense)                                : $pp.set.tstatus(B)
  325.     echo -- Ignoring of CTCP PINGs (PING)                           : $pp.set.tstatus(X)
  326.     echo -- Ignoring of CTCP FINGERs (FINGer)                       : $pp.set.tstatus(Z)
  327.     echo -- Ignoring of CTCP VERSIONs (VERsion)                     : $pp.set.tstatus(Y)
  328.     echo -- Seconds to auto-ignore flooders (IGTime)                : ${PP.SET.IGSECS}
  329.     echo -- Nick flood protection sensitivity (NFSens)              : ${PP.SET.NFSENS}
  330.     echo -- Length of first word for a msg to be junkflood (JFLEN)  : ${PP.SET.JFLEN}
  331.     echo -- Desynched user notification (DESynchnote)               : $pp.set.tstatus(V)
  332.     if (PP.SET.AUTOAWAY) {
  333.     echo -- Minutes of idle time before being set away (AUTOAway)   : ${PP.SET.AUTOAWAY}
  334.     } {
  335.     echo -- Minutes of idle time before being set away (AUTOAway)   : OFF
  336.     }
  337. #    echo -- NS lookup of IP adresses on join                        : $pp.set.onoff($PP.SET.LOOKJOIN)
  338.     echo -- Clonebot mass-join protection (CLONEProt)               : $pp.set.tstatus(C)
  339.     echo -- Clonebot mass-join protection sensitivity (CLONESens)   : ${PP.SET.CPSENS}
  340.     if (suppress_server_motd == [ON])
  341.     {
  342.     echo -- Server motd display at startup (MOTD)                   : OFF
  343.     } {
  344.     echo -- Server motd display at startup (MOTD)                   : ON
  345.     }
  346.     echo -- Show users who join/signoff in splits (SHOWSPLITters)   : $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  347. #    echo -- Auto-loading of pp-bots.irc (LOADBots)                  : $pp.set.sload(B)
  348.     echo -- Auto-loading of pp-dcc.irc (LOADDcc)                   : $pp.set.sload(X)
  349.     echo -- Auto-loading of pp-silly.irc (LOADSilly)                : $pp.set.sload(S)
  350.     echo -- Auto-loading of pp-kicks.irc (LOADKicks)                : $pp.set.sload(K)
  351.     echo -- Suppression of script startup screens                   : $pp.set.onoff($PP.SET.NOSTARTUP)
  352.     echo -- Insert random ?'s into bans (FUNkybans)                 : $pp.set.onoff($PP.SET.FUNKYBANS)
  353.     echo -- Beep on netsplits (BEEPSPLIT)                           : $pp.set.onoff($PP.SET.BSP)
  354.     echo -- CTCP PAGE (PAGE)                                        : $pp.set.onoff($PP.SET.CTCPPAGE)
  355.     echo -- Print time every 10 minutes (TPRINT)                    : $pp.set.onoff($PP.SET.TP)
  356.     echo -- ===========================================================================
  357. }
  358.  
  359. alias pp.set.sload {
  360.     if ([$1])
  361.     {
  362.         if ([$1] == [ON])
  363.         {
  364.             if (index($0 $PP.SET.AUTOLOAD) < 0) {@ PP.SET.AUTOLOAD = PP.SET.AUTOLOAD##[$0]}
  365.             pp.autoload
  366.         } {@ PP.SET.AUTOLOAD = strip($0 $PP.SET.AUTOLOAD)}
  367.     } {^if (index($0 $PP.SET.AUTOLOAD) >= 0) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  368. }
  369. alias pp.autoload {
  370.     if ((index(K $PP.SET.AUTOLOAD) >= 0)&&(!(PP.KICKS))) {/load pp-kicks.irc}
  371.     if ((index(B $PP.SET.AUTOLOAD) >= 0)&&(!(PP.BOTS))) {/load pp-bots.irc}
  372.     if ((index(S $PP.SET.AUTOLOAD) >= 0)&&(!(PP.SILLY))) {/load pp-silly.irc}
  373.     if ((index(X $PP.SET.AUTOLOAD) >= 0)&&(!(PP.DCC))) {/load pp-dcc.irc}
  374.     if ((index(W $PP.SET.AUTOLOAD) >= 0)&&(!(PP.WAR))) {/load pp-war.irc}
  375. }
  376.  
  377. # *** Main script settings:
  378. # AIGnore = Automatic flood ignoring
  379. # FFILTer = Filtering of known floods
  380. # ARTKick = ASCII art kicker
  381. # NFProt = Kicking on nick flood
  382. # ENEMies = Use of enemies list
  383. # FRIends = Use of friends list
  384. # AWAYNotices = Public announcement of away status
  385. # AWAYLogging = Logging of msgs/events while away
  386. # AWAYWriting = Logging to an away log file
  387. # AFILE = Name of away log file
  388. # NOTIces = General warnings/notices
  389. # KREJoin = Automatic rejoining on kick
  390. # MASSProt = Mass deop/kick protection
  391. # MASSAction = Action taken on mass deop/kick
  392. # SERVOP = Automatic removal of server ops
  393. # KEYProt = Channel key flash protection
  394. # BANDefense = Ban defense
  395. # PING = Ignoring of CTCP PING
  396. # FINGer = Ignoring of CTCP FINGER
  397. # VERsion = Ignoring of CTCP VERSION
  398. # IGTime = Seconds to auto-ignore flooders
  399. # NFSens = Sensitivity of nick flood protection (higher values more sensitive)
  400. # JFLEN = First word length for a message to be a junkflood
  401. # *CMD = Correspond with PP.SET.*CMD above
  402. # MSGBeep = Beep on private messages
  403. # AUTOAway = Minutes of idle-time to be automaticly set away
  404. # CLONEProt = Clonebot mass-join protection
  405. # CLONESens = Sensitivity of clonebot mass-join protection (lower values more sensitive)
  406. # ROWS = Number of rows on display
  407. # LOADBots = Auto load pp-bots.irc
  408. # LOADWar = Auto load pp-war.irc
  409. # LOADSilly = Auto load pp-silly.irc
  410. # LOADKicks = Auto load pp-kicks.irc
  411. # LOADDcc = Auto load pp-dcc.irc
  412. # HELPUnload = Auto unloading of help
  413. # DESynchnote = Desynched user notification
  414. # WRITEMETHOD = /sve write method
  415. # MOTD = Server motd display at startup
  416. # CHANprot = Channel protection
  417. # SHOWSPLITters = Show users who join/signoff in splits
  418. # LOOKJoin = NS lookup of IP adresses on join
  419. # NOSTARTUP = Suppression of startup screens
  420. # FUNkybans = Insert random ?'s into bans
  421. # BEEPSPLIT = Beep on netsplits
  422. # PAGE = CTCP PAGE
  423. # TPRINT = Print time every 10 minutes
  424. alias pp.set.m {
  425.     if (rmatch($0 LOADK* LOADB* LOADW* LOADS* LOADD*))
  426.     {
  427.         if (match($1 ON OFF))
  428.         {
  429.             if (match(LOADB* $0)) {/pp.set.sload B $1}
  430.             if (match(LOADW* $0)) {/pp.set.sload W $1}
  431.             if (match(LOADS* $0)) {/pp.set.sload S $1}
  432.             if (match(LOADK* $0)) {/pp.set.sload K $1}
  433.             if (match(LOADD* $0)) {/pp.set.sload X $1}
  434.         }
  435.         if (match(LOADB* $0)) {/echo *** Auto-loading of pp-bots.irc is now $pp.set.sload(B)}
  436.         if (match(LOADW* $0)) {/echo *** Auto-loading of pp-war.irc is now $pp.set.sload(W)}
  437.         if (match(LOADS* $0)) {/echo *** Auto-loading of pp-silly.irc is now $pp.set.sload(S)}
  438.         if (match(LOADK* $0)) {/echo *** Auto-loading of pp-kicks.irc is now $pp.set.sload(K)}
  439.         if (match(LOADD* $0)) {/echo *** Auto-loading of pp-dcc.irc is now $pp.set.sload(X)}
  440.         @ VU = 1
  441.     }
  442.     if ([$0] == [PAGE])
  443.     {
  444.         if (match($1 ON OFF))
  445.         {
  446.             if ([$1] == [ON]) {@ PP.SET.CTCPPAGE = 1} {@ PP.SET.CTCPPAGE = 0}
  447.         }
  448.         echo *** CTCP PAGE response is now $pp.set.onoff($PP.SET.CTCPPAGE)
  449.         @ VU = 1
  450.     }
  451.     if ([$0] == [TPRINT])
  452.     {
  453.         if (match($1 ON OFF))
  454.         {
  455.             if ([$1] == [ON]) {@ PP.SET.TP = 1} {@ PP.SET.TP = 0}
  456.         }
  457.         echo *** Print time every 10 minutes is now $pp.set.onoff($PP.SET.TP)
  458.         @ VU = 1
  459.     }
  460.     if ([$0] == [BEEPSPLIT])
  461.     {
  462.         if (match($1 ON OFF))
  463.         {
  464.             if ([$1] == [ON]) {@ PP.SET.BSP = 1} {@ PP.SET.BSP = 0}
  465.         }
  466.         echo *** Beep on netsplits is now $pp.set.onoff($PP.SET.BSP)
  467.         @ VU = 1
  468.     }
  469. #    if (match(LOOKJ* $0))
  470. #    {
  471. #        if (match($1 ON OFF))
  472. #        {
  473. #            if ([$1] == [ON]) {@ PP.SET.LOOKJOIN = 1} {@ PP.SET.LOOKJOIN = 0}
  474. #        }
  475. #        echo *** NS lookup of IP adresses on join is now $pp.set.onoff($PP.SET.LOOKJOIN)
  476. #        @ VU = 1
  477. #    }
  478.     if ([$0] == [NOSTARTUP])
  479.     {
  480.         if (match($1 ON OFF))
  481.         {
  482.             if ([$1] == [ON]) {@ PP.SET.NOSTARTUP = 1} {@ PP.SET.NOSTARTUP = 0}
  483.         }
  484.         echo *** Suppression of script startup screens is now $pp.set.onoff($PP.SET.NOSTARTUP)
  485.         @ VU = 1
  486.     }
  487.     if (match(FUN* $0))
  488.     {
  489.         if (match($1 ON OFF))
  490.         {
  491.             if ([$1] == [ON]) {@ PP.SET.FUNKYBANS = 1} {@ PP.SET.FUNKYBANS = 0}
  492.         }
  493.         echo *** Insert random ?'s into bans is now $pp.set.onoff($PP.SET.FUNKYBANS)
  494.         @ VU = 1
  495.     }
  496.     if (match(SHOWSPLIT* $0))
  497.     {
  498.         if (match($1 ON OFF))
  499.         {
  500.             if ([$1] == [ON]) {@ PP.SET.SHOWSPLITTERS = 1} {@ PP.SET.SHOWSPLITTERS = 0}
  501.         }
  502.         echo *** Showing of users who join/signoff in netsplits is now $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  503.         @ VU = 1
  504.     }
  505.     if (match(CHAN* $0))
  506.     {
  507.         if (match($1 ON OFF))
  508.         {
  509.             if ([$1] == [ON]) {@ PP.SET.CHANPROT = 1} {@ PP.SET.CHANPROT = 0}
  510.         }
  511.         echo *** Channel protection is now $pp.set.onoff($PP.SET.CHANPROT)
  512.         @ VU = 1
  513.     }
  514.     if (match(DES* $0))
  515.     {
  516.         ^pp.set.changetoggle V $1
  517.         echo *** Desynched user notification is now $pp.set.tstatus(V)
  518.         @ VU = 1
  519.     }
  520.     if (match(AIG* $0))
  521.     {
  522.         ^pp.set.changetoggle I $1
  523.         echo *** Auto-ignoring on msg/notice/ctcp/nick floods is now $pp.set.tstatus(I)
  524.         @ VU = 1
  525.     }
  526.     if ([$0] == [MOTD])
  527.     {
  528.         if (match($1 ON OFF))
  529.         {
  530.             if ([$1] == [ON]) {^set suppress_server_motd OFF} {^set suppress_server_motd ON}
  531.         }
  532.         if (suppress_server_motd == [ON]) {/echo *** Server motd display at startup is now OFF}
  533.         {/echo *** Server motd display at startup is now ON}
  534.         @ VU = 1
  535.     }
  536.     if (match(FFILT* $0))
  537.     {
  538.         ^pp.set.changetoggle F $1
  539.         echo *** Filtering of known floods in msgs/notices/public messages is now $pp.set.tstatus(F)
  540.         @ VU = 1
  541.     }
  542.     if (match(ARTK* $0))
  543.     {
  544.         ^pp.set.changetoggle A $1
  545.         echo *** ASCII art kicker is now $pp.set.tstatus(A)
  546.         @ VU = 1
  547.     }
  548.     if (match(HELPU* $0))
  549.     {
  550.         ^pp.set.changetoggle P $1
  551.         echo *** Automatic unloading of help information is now $pp.set.tstatus(P)
  552.         @ VU = 1
  553.     }
  554.     if (match(NFP* $0))
  555.     {
  556.         ^pp.set.changetoggle N $1
  557.         echo *** Kicking on nick flood is now $pp.set.tstatus(N)
  558.         @ VU = 1
  559.     }
  560.     if (match(ENEM* $0))
  561.     {
  562.         ^pp.set.changetoggle E $1
  563.         echo *** Checking/use of enemies list is now $pp.set.tstatus(E)
  564.         @ VU = 1
  565.     }
  566.     if (match(FRI* $0))
  567.     {
  568.         ^pp.set.changetoggle L $1
  569.         echo *** Checking/use of friends list is now $pp.set.tstatus(L)
  570.         @ VU = 1
  571.     }
  572.     if (match(AWAYN* $0))
  573.     {
  574.         ^pp.set.changetoggle O $1
  575.         echo *** Public announcement of away status is now $pp.set.tstatus(O)
  576.         @ VU = 1
  577.     }
  578.     if (match(AWAYL* $0))
  579.     {
  580.         ^pp.set.changetoggle G $1
  581.         echo *** Logging of messages and important events while away is now $pp.set.tstatus(G)
  582.         @ VU = 1
  583.     }
  584.     if (match(NOTI* $0))
  585.     {
  586.         ^pp.set.changetoggle W $1
  587.         echo *** Sending of general warnings/notices is now $pp.set.tstatus(W)
  588.         @ VU = 1
  589.     }
  590.     if (match(KREJ* $0))
  591.     {
  592.         ^pp.set.changetoggle J $1
  593.         echo *** Automatic rejoining on kick is now $pp.set.tstatus(J)
  594.         @ VU = 1
  595.     }
  596.     if (match(MASSP* $0))
  597.     {
  598.         ^pp.set.changetoggle M $1
  599.         echo *** Mass deop/kick protection is now $pp.set.tstatus(M)
  600.         @ VU = 1
  601.     }
  602.     if (match(MASSA* $0))
  603.     {
  604.         if (match($1 KICK DEOP))
  605.         {
  606.             if ([$1] == [KICK]) {@ PP.SET.MASSRESP = 1} {@ PP.SET.MASSRESP = 0}
  607.         }
  608.         if (PP.SET.MASSRESP) {/echo *** Action taken on mass deop/kick is now KICK}
  609.         {/echo *** Action taken on mass deop/kick is now DEOP}
  610.         @ VU = 1
  611.     }
  612.     if (match(KEYP* $0))
  613.     {
  614.         ^pp.set.changetoggle K $1
  615.         echo *** Channel key flash protection is now $pp.set.tstatus(K)
  616.         @ VU = 1
  617.     }
  618.     if (([$0] == [SERVOP])||([$0] == [NHP]))
  619.     {
  620.         ^pp.set.changetoggle S $1
  621.         echo *** Automatic removal of server ops is now $pp.set.tstatus(S)
  622.         @ VU = 1
  623.     }
  624.     if (match(CLONEP* $0))
  625.     {
  626.         ^pp.set.changetoggle C $1
  627.         echo *** Clonebot mass-join protection is now $pp.set.tstatus(C)
  628.         @ VU = 1
  629.     }
  630.     if (match(BAND* $0))
  631.     {
  632.         ^pp.set.changetoggle B $1
  633.         echo *** Ban defense is now $pp.set.tstatus(B)
  634.         @ VU = 1
  635.     }
  636.     if ([$0] == [PING])
  637.     {
  638.         ^pp.set.changetoggle X $1
  639.         echo *** Ignoring of CTCP PINGs is now $pp.set.tstatus(X)
  640.         @ VU = 1
  641.         ^pp.set.setupctcp
  642.     }
  643.     if (match(FING* $0))
  644.     {
  645.         ^pp.set.changetoggle Z $1
  646.         echo *** Ignoring of CTCP FINGERs is now $pp.set.tstatus(Z)
  647.         @ VU = 1
  648.         ^pp.set.setupctcp
  649.     }
  650.     if (match(VER* $0))
  651.     {
  652.         ^pp.set.changetoggle Y $1
  653.         echo *** Ignoring of CTCP VERSIONs is now $pp.set.tstatus(Y)
  654.         @ VU = 1
  655.         ^pp.set.setupctcp
  656.     }
  657.     if (match(IGT* $0))
  658.     {
  659.         if ([$1]) {
  660.             if (!isalpha($1)) {@ PP.SET.IGSECS = [$1]}
  661.             {/echo *** Must be a number (recommended value: 10-60)}
  662.         }
  663.         echo *** Number of seconds to auto-ignore flooders is now: ${PP.SET.IGSECS}
  664.         @ VU = 1
  665.     }
  666.     if (match(NFS* $0))
  667.     {
  668.         if ([$1]) {
  669.             if (!isalpha($1)) {@ PP.SET.NFSENS = [$1]}
  670.             {/echo *** Must be a number (recommended value: 3)}
  671.         }
  672.         echo *** Nick flood protection sensitivity is now: ${PP.SET.NFSENS}
  673.         if (PP.SET.NFSENS > 3) {/echo *** Warning: a setting of ${PP.SET.NFSENS} is very sensitive! (higher values more sensitive)}
  674.         @ VU = 1
  675.     }
  676.     if (match(CLONES* $0))
  677.     {
  678.         if ([$1]) {
  679.             if (!isalpha($1)) {@ PP.SET.CPSENS = [$1]}
  680.             {/echo *** Must be a number (recommended value: 3-5)}
  681.         }
  682.         echo *** Clonebot mass-join protection sensitivity is now: ${PP.SET.CPSENS}
  683.         if (PP.SET.CPSENS < 3) {/echo *** Warning: a setting of ${PP.SET.CPSENS} is very sensitive! (lower values more sensitive)}
  684.         @ VU = 1
  685.     }
  686.     if ([$0] == [JFLEN])
  687.     {
  688.         if ([$1]) {
  689.             if (!isalpha($1)) {@ PP.SET.JFLEN = [$1]}
  690.             {/echo *** Must be a number (recommended value: 200)}
  691.         }
  692.         echo *** First word length for a message to be a junkflood is now: ${PP.SET.JFLEN}
  693.         @ VU = 1
  694.     }
  695.     if (match(AUTOA* $0))
  696.     {
  697.         if ([$1]) {
  698.             if (!isalpha($1)) {@ PP.SET.AUTOAWAY = [$1]}
  699.             {
  700.                 if ([$1] == [OFF]) {@ PP.SET.AUTOAWAY = 0} {/echo *** Must be a number or 'off' to turn off.}
  701.             }
  702.         }
  703.         echo *** Minutes of idle-time before being set away (0=auto-away disabled): ${PP.SET.AUTOAWAY}
  704.         @ VU = 1
  705.     }
  706.     if (match(*CMD $0))
  707.     {
  708.         foreach PP.SET AA {
  709.             if ([$AA] == [$0])
  710.             {
  711.                 if ([$1]) {@ PP.SET[$AA] = [$1-]}
  712.                 echo *** $AA is now [${PP.SET[$AA]}]
  713.                 @ VU = 1
  714.             }
  715.         }
  716.     }
  717.     if (match(LOGF* $0))
  718.     {
  719.         if ([$1]) {^set logfile $1}
  720.         echo *** IRC logging is now sent to file ${LOGFILE}
  721.         @ VU = 1
  722.     }
  723.     if ([$0] == [LOG])
  724.     {
  725.         if (match($1 ON OFF)) {^if ([$1] == [ON]) {^set log on} {^set log off}}
  726.         echo *** Logging to $LOGFILE is now ${LOG}
  727.         @ VU = 1
  728.     }
  729. }
  730.  
  731. alias pp {
  732.     if ([$0])
  733.     {
  734.         @ VU = 0
  735.         foreach PP.SETCHECKS AA {^if (!VU) {$PP.SETCHECKS[$AA] $*}}
  736.         if (!VU) {/echo *** No such variable: $0}
  737.         ^assign -VU
  738.     } {/echo *** /pp <variable> [<new setting>] (If new setting is left out, current setting is shown)}
  739. }
  740.  
  741. # ----------------------------------------------------------------------------
  742. # Command abbreviations
  743. # ----------------------------------------------------------------------------
  744.  
  745. alias w {/who $*}
  746. alias m {/msg $*}
  747. alias c {/mode $*}
  748. alias l {
  749.     leave $0
  750.     if ([$1]) {/l $1-}
  751. }
  752. alias j {
  753.     if (ischannel($1)) {/join $0} {/join $0 $1}
  754.     if (ischannel($1)) {/j $1-}
  755.     if (ischannel($2)) {/j $2-}
  756. }
  757. alias , {/whois $*}
  758. alias wi {/whois $*}
  759. alias ww {/whowas $*}
  760. alias n {/nick $*}
  761. alias k {/kick $*}
  762. alias o {/op $*}
  763. alias d {/deop $*}
  764.  
  765. alias scan {/names $*}
  766.  
  767. # ----------------------------------------------------------------------------
  768. # Basic channel op command aliases
  769. # ----------------------------------------------------------------------------
  770.  
  771. # Here's all the recursive list processing aliases for the mass commands
  772. # pp.listm.<# at once> <mode> <#channel> <users>
  773. alias pp.listm.1 {
  774.     //mode $1 $0 $2
  775.     if ([$3]) {^pp.listm.1 $0 $1 $3-}
  776. }
  777. alias pp.listm.2 {
  778.     //mode $1 $0 $2 $3
  779.     if ([$4]) {^pp.listm.2 $0 $1 $4-}
  780. }
  781. alias pp.listm.3 {
  782.     //mode $1 $0 $2 $3 $4
  783.     if ([$5]) {^pp.listm.3 $0 $1 $5-}
  784. }
  785. alias pp.listm.4 {
  786.     //mode $1 $0 $2 $3 $4 $5
  787.     if ([$6]) {^pp.listm.4 $0 $1 $6-}
  788. }
  789. # pp.listk <#channel> <nicks> ($KREASON contains reason for kicks)
  790. alias pp.listk {
  791.     //kick $0 $1 $KREASON
  792.     if ([$2]) {^pp.listk $0 $2-}
  793. }
  794. # pp.listdcc <file> <nicks>
  795. alias pp.listdcc {
  796.     //^dcc send $1 $0
  797.     if ([$2]) {^pp.listdcc $0 $2-}
  798. }
  799. # pp.listmsg <PRIVMSG/NOTICE> <nicks/channels> (SEND_MSG contains message)
  800. alias pp.listmsg {
  801.     ^quote $0 $1 :$SEND_MSG
  802.     if ([$2]) {^pp.listmsg $0 $2-}
  803. }
  804. # pp.listunban <#channel> <strings>
  805. alias pp.listunban {
  806.     if ([$4])
  807.     {
  808.         //mode $0 -bbb $1 $2 $3
  809.         ^pp.listunban $0 $4-
  810.     } {^if ([$3]) {//mode $0 -bbb $1 $2 $3} {^if ([$2]) {//mode $0 -bb $1 $2} {^if ([$1]) {//mode $0 -b $1}}}}
  811. }
  812.  
  813. # pp.mdop <#channel> <# at once> <mask>
  814. # Smart massdeopper: deops the closest people net-wise first.  (Gee, I wonder
  815. # how many scripts this is gonna appear in?)
  816. alias pp.mdop {
  817.     @ HIGHHOPS = 0
  818.     @ DMASK = [$2]
  819.     on ^who * {
  820.         if ((match(*${DMASK}* $1!$3@$4))&&([$1] != N))
  821.         {
  822.             if (!match($1 $PP.BOTNICKS))
  823.             {
  824.                 if (!PP.EPIC)
  825.                 {
  826.                     @ MDOPZ[$5] = MDOPZ[$5]##[ $1]
  827.                     if ([$5] > HIGHHOPS) {@ HIGHHOPS = [$5]}
  828.                 }
  829.                 {
  830.                     @ MDOPZ[$6] = MDOPZ[$6]##[ $1]
  831.                     if ([$6] > HIGHHOPS) {@ HIGHHOPS = [$6]}
  832.                 }
  833.             }
  834.         }
  835.     }
  836.     //^who -chops $0
  837.     @ DEOPCNT = [$1]
  838.     @ DEOPCHAN = [$0]
  839.     wait -CMD if (1) {
  840.         if (DEOPCNT <= 1) {@ MCH = [-o]}
  841.         if (DEOPCNT == 2) {@ MCH = [-oo]}
  842.         if (DEOPCNT == 3) {@ MCH = [-ooo]}
  843.         if (DEOPCNT >= 4) {@ MCH = [-oooo]}
  844.         @ CTR = 0
  845.         while (CTR <= HIGHHOPS)
  846.         {
  847.             @ MDOPZ = MDOPZ##[ $MDOPZ[$CTR]]
  848.             ^assign -MDOPZ[$CTR]
  849.             @ CTR = CTR + 1
  850.         }
  851.         ^pp.listm.$DEOPCNT $MCH $DEOPCHAN $MDOPZ
  852.         ^assign -DEOPCNT
  853.         ^assign -DEOPCHAN
  854.         ^assign -MCH
  855.         ^assign -HIGHHOPS
  856.         ^assign -CTR
  857.         ^assign -MDOPZ
  858.         ^assign -DMASK
  859.         ^on who -
  860.     }
  861. }
  862.  
  863. # pp.mkick <#channel> <mask> <reason>
  864. alias pp.mkick {
  865.     @ KMASK = [$1]
  866.     ^on ^who * {
  867.         ^if ((match(*${KMASK}* $1!$3@$4))&&([$1] != N))
  868.         {
  869.             ^if (!match($1 $PP.BOTNICKS)) {@ MKZ = [$1 $MKZ]}
  870.         }
  871.     }
  872.     //^who $0
  873.     @ KCHAN = [$0]
  874.     @ KREASON = [$2-]
  875.     wait -CMD if (1) {
  876.         ^pp.listk $KCHAN $MKZ
  877.         ^assign -KCHAN
  878.         ^assign -MKZ
  879.         ^assign -KMASK
  880.         ^assign -KREASON
  881.         ^on who -
  882.     }
  883. }
  884.  
  885. # pp.mop <#channel> <mask>
  886. alias pp.mop {
  887.     @ OPMASK = [$1]
  888.     ^on ^who * {^if ((!match(*@* $2))&&(match(*${OPMASK}* $1!$3@$4))) {^if ([$1] != N) {@ MOPZ = [$MOPZ $1]}}}
  889.     //^who $0
  890.     @ MOPCHAN = [$0]
  891.     wait -CMD if (1) {
  892.         ^pp.listm.3 +ooo $MOPCHAN $MOPZ
  893.         ^assign -MOPCHAN
  894.         ^assign -MOPZ
  895.         ^assign -OPMASK
  896.         ^on ^who -
  897.     }
  898. }
  899.  
  900. # pp.modev <#channel> <mask> <+/->
  901. alias pp.modev {
  902.     @ VMASK = [$1]
  903.     ^on ^who * {^if (match(*${VMASK}* $1!$3@$4)) {@ MVZ = [$MVZ $1]}}
  904.     //^who $0
  905.     @ MVCHAN = [$0]
  906.     @ MVMODE = [$2]
  907.     wait -CMD if (1) {
  908.         ^pp.listm.3 ${MVMODE}vvv $MVCHAN $MVZ
  909.         ^assign -MVCHAN
  910.         ^assign -MVMODE
  911.         ^assign -MVZ
  912.         ^assign -VMASK
  913.         ^on ^who -
  914.     }
  915. }
  916.  
  917. # The user mass commands
  918. # mdop/mvop/mop/munvop [<mask>]
  919. alias mdop.1 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 1 $0} {^pp.mdop $C 1 *}} {/echo *** You don't have ops on $C}}
  920. alias mdop.2 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 2 $0} {^pp.mdop $C 2 *}} {/echo *** You don't have ops on $C}}
  921. alias mdop.3 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 3 $0} {^pp.mdop $C 3 *}} {/echo *** You don't have ops on $C}}
  922. alias mdop.4 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 4 $0} {^pp.mdop $C 4 *}} {/echo *** You don't have ops on $C}}
  923. alias mdop {^mdop.4 $*}
  924. alias mop {^if (gotops($C)) {^if ([$0]) {^pp.mop $C $0} {^pp.mop $C *}} {/echo *** You don't have ops on $C}}
  925. alias mvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 +} {^pp.modev $C * +}} {/echo *** You don't have ops on $C}}
  926. alias munvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 -} {^pp.modev $C * -}} {/echo *** You don't have ops on $C}}
  927.  
  928. # op and deop aliases
  929. # op/deop <nicks>
  930. alias op {^if ([$0]) {^pp.listm.3 +ooo $C $*} {/echo *** /op <nick> [<nick> ...]}}
  931. alias deop {^if ([$0]) {^pp.listm.2 -oo $C $*} {/echo *** /deop <nick> [<nick> ...]}}
  932.  
  933. # masskick aliases
  934. # masskick [<reason>] (kicks with mask *)  mkick [<mask>]
  935. alias masskick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C * $*} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  936. alias mkick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C $0 [Masskick: $0]} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  937.  
  938. # Kicks all non-operators on channel
  939. alias lkick {
  940.     if (gotops($C))
  941.     {
  942.         ^on ^who * {/if (([$1] != N)&&(!rmatch($2 *@*))) {//kick $0 $1 [Non-Operator Kick]}}
  943.         //^who *
  944.         wait -CMD ^on who -
  945.     } {/echo *** You don't have ops on $C}
  946. }
  947.  
  948. # massdcc <file> [<mask>]
  949. alias massdcc {
  950.     if ([$0])
  951.     {
  952.         if ([$1]) {@ DCCMASK = [$1]} {@ DCCMASK = [*]}
  953.         ^on ^who * {^if (([$1] != N)&&(match(*${DCCMASK}* $1!$3@$4))) {@ DCCPPL = [$1 $DCCPPL]}}
  954.         //^who *
  955.         @ MDFILE = [$0]
  956.         wait -CMD if (1) {
  957.             ^on who -
  958.             ^pp.listdcc $MDFILE $DCCPPL
  959.             ^assign -DCCMASK
  960.             ^assign -DCCPPL
  961.             echo *** Sent DCC SEND request for $MDFILE to everyone in $C
  962.             ^assign -MDFILE
  963.         }
  964.     } {/echo *** /massdcc <file> [<mask>]}
  965. }
  966.  
  967. # Re-aliased to not require channel names
  968. alias invite {^if (ischannel($1)) {//invite $*} {//invite $0 $C}}
  969. alias kick {^if (ischannel($0)) {//kick $*} {//kick $C $0 $1-}}
  970. alias mode {^if (ischannel($0)) {//mode $*} {^if ([$0] == N) {//mode $*} {//mode $C $*}}}
  971.  
  972. # Snak adaptation 1.3 Snak has integrated highlighting
  973. # Snak adaptation 1.10 no longer do the kludgy dcc fserve hack where you try to send the pack to yourself to get the size
  974. alias nick {
  975.     ^if ([$0])
  976.     {
  977. #        if (PP.DCC) {^dcc.onnick $*}
  978.         quote NICK $*
  979.     } {/nick $randcrap(9)}
  980. }
  981.  
  982. # We don't use the -k$M method because of how the mode locking code works
  983. alias clearmode {
  984.     if (ischannel($0))
  985.     {
  986.         ^on ^324 * {@ CMODE = strip(:+ $2)##[ $3-]}
  987.         //mode $0
  988.         @ CMCHAN = [$0]
  989.         wait -CMD if (1) {
  990.             ^on 324 -
  991.             //mode $CMCHAN -k$CMODE
  992.             ^assign -CMCHAN
  993.             ^assign -CMODE
  994.         }
  995.     } {/clearmode $C}
  996. }
  997.  
  998. # Bans bots and bomb/inverse/beep/etc usernames
  999. alias botban {//mode $C +bbb *b?t!*@* *srv!*@* *s?rv!*@*}
  1000. alias bot {//bot}
  1001.  
  1002. # pp.clearban <channel> <mask>
  1003. alias pp.clearban {
  1004.     @ BANMASK = [$1]
  1005.     ^on ^raw_irc "% 367 *" {^if ((match(*${BANMASK}* $4))||(match($4 $BANMASK))) {@ CBUNBAND = [$4 $CBUNBAND]}}
  1006.     //mode $0 b
  1007.     wait -CMD if (1) {
  1008.         ^pp.listunban $C $CBUNBAND
  1009.         ^assign -CBUNBAND
  1010.         ^assign -BANMASK
  1011.         ^on raw_irc - "% 367 *"
  1012.     }
  1013. }
  1014.  
  1015. # User clearban alias
  1016. # clearban [<mask>]
  1017. alias clearban {^if ([$0]) {^pp.clearban $C $*} {^pp.clearban $C *}}
  1018.  
  1019. # Unban alias: looks up user's user@host and runs a clearban
  1020. # unban <nick>
  1021. alias unban {
  1022.     if ([$0]) {
  1023.         if (match(*!*@* $0)) {^pp.listunban $C $*}
  1024.         {
  1025.             ^Userhost $0 -CMD if ([$3]) {
  1026.                 if ([$4] != [<UNKNOWN>]) {^pp.clearban $C $0!$3@$4} {/echo *** $0 is not on IRC}
  1027.             }
  1028.         }
  1029.     } {/echo *** /unban <nick/umask>}
  1030. }
  1031.         
  1032. # ban <nick>
  1033. alias ban {
  1034.     if ([$0])
  1035.     {
  1036.         if (match(*!*@* $0)) {//mode $C +bbb $*}
  1037.         {
  1038.             ^Userhost $0 -CMD if ([$3]) {
  1039.                 if ([$4] != [<UNKNOWN>])
  1040.                 {
  1041.                     @ HNAME = [$4]
  1042.                     if ((!isalpha($HNAME))&&(match(*.*.*.* $HNAME))) {@ ST = [*!*$mid(1 1000 $3)@]##left($rindex(. $HNAME) $HNAME)##[.*]}
  1043.                     {@ ST = [*!*$mid(1 1000 $3)@*$right(${@HNAME-index(. $4)} $4)]}
  1044.                     if (PP.SET.FUNKYBANS)
  1045.                     {
  1046.                         @ AA = []
  1047.                         @ CT = 0
  1048.                         while (CT < [$@ST])
  1049.                         {
  1050.                             @ SC = mid($CT 1 $ST)
  1051.                             if ((!match(*${SC}* @!.))&&(SC != [*]))
  1052.                             {
  1053.                                 if (rand(4) == 2) {@ AA = AA##[?]}
  1054.                                 {@ AA = AA##SC}
  1055.                             } {@ AA = AA##SC}
  1056.                             @ CT = CT + 1
  1057.                         }
  1058.                         ^assign -CT
  1059.                         ^assign -SC
  1060.                     } {@ AA = ST}
  1061.                     ^assign -ST
  1062.                     ^assign -HNAME
  1063.                     //mode $C +b $AA
  1064.                 } {/echo *** $0 is not on IRC}
  1065.             }
  1066.         }
  1067.     } {//mode $C b}
  1068. }
  1069.  
  1070. # /wordkick <channel> <word/phrase>
  1071. # or /wordkick <channel> off
  1072. alias wordkick {
  1073.     if ([$1])
  1074.     {
  1075.         if (ischannel($0)) {@ WCHAN = [$0]} {@ WCHAN = [#$0]}
  1076.         if ([$1] == [OFF])
  1077.         {
  1078.             foreach WORDKICKS AA {
  1079.                 if (decode($AA) == [$WCHAN])
  1080.                 {
  1081.                     EVAL ^on raw_irc - "% ??????% $decode($AA) :*$WORDKICKS[$AA]*"
  1082.                     ^assign -WORDKICKS[$AA]
  1083.                     @ WK = 1
  1084.                 }
  1085.             }
  1086.             if (WK) {/echo *** Wordkick for $WCHAN removed} {/echo *** There is no wordkick active on $WCHAN}
  1087.             ^assign -WK
  1088.         }
  1089.         {
  1090.             @ WORDKICKS[$encode($WCHAN)] = [$1-]
  1091.             EVAL ^on -raw_irc "% ??????% $WCHAN :*$1-*" {
  1092.                 //kick $2 $nickonly($0) [Wordkick]
  1093.             }
  1094.             echo *** Wordkick for '$1-' now active on channel $WCHAN
  1095.         }
  1096.         ^assign -WCHAN
  1097.     }
  1098.     {
  1099.         echo *** Active wordkicks:
  1100.         foreach WORDKICKS AA {/echo *** Channel: $[12]decode($AA) Word/phrase: $WORDKICKS[$AA]}
  1101.     }
  1102. }
  1103.  
  1104. # ----------------------------------------------------------------------------
  1105. # Friends and enemies lists handlers
  1106. # ----------------------------------------------------------------------------
  1107.  
  1108. # 'CK' is $encode(*)
  1109.  
  1110. # pp.addl <FRIENDS/ENEMIES> <umask> <channel/*>
  1111. alias pp.addl {
  1112.     if ((!match($1 $PP[$0][$encode($toupper($2))]))&&(!match($1 $PP[$0][CK])))
  1113.     {
  1114.         if (PP[$0][$encode($toupper($2))]) {@ PP[$0][$encode($toupper($2))] = PP[$0][$encode($toupper($2))]##[ $1]} {@ PP[$0][$encode($toupper($2))] = [$1]}
  1115.         if ([$2] == [*]) {/echo *** User mask [$1] added to global $tolower($0) list}
  1116.         {/echo *** User mask [$1] added to $tolower($0) list for channel mask $2}
  1117.     }
  1118.     {
  1119.         if ([$2] == [*]) {/echo *** A user mask matching [$1] is already on your global friends list}
  1120.         {/echo *** A user mask matching [$1] is already on the list for channel mask $2 or the global list}
  1121.     }
  1122. }
  1123. # pp.rml <FRIENDS/ENEMIES> <umask> <channel/*>
  1124. alias pp.rml {
  1125.     if ((match($1 $PP[$0][$encode($toupper($2))]))||(rmatch($1 $PP[$0][$encode($toupper($2))])))
  1126.     {
  1127.         @ CN = encode($toupper($2))
  1128.         @ AA = 0
  1129.         while (word($AA $PP[$0][$CN]))
  1130.         {
  1131.             if ((match($1 $word($AA $PP[$0][$CN])))||(match($word($AA $PP[$0][$CN]) $1)))
  1132.             {
  1133.                 ^delword $word($AA $PP[$0][$CN]) $PP[$0][$CN]
  1134.                 @ PP[$0][$CN] = NLIST
  1135.                 ^assign -NLIST
  1136.                 @ AA = 0
  1137.             } {@ AA = AA + 1}
  1138.         }
  1139.         if (!(word(0 $PP[$0][$CN]))) {^assign -PP[$0][$CN]}
  1140.         ^assign -CN
  1141.         if ([$2] == [*]) {/echo *** All patterns matching [$1] removed from global $tolower($0) list}
  1142.         {/echo *** All patterns matching [$1] removed from list for channel mask $2}
  1143.     }
  1144.     {
  1145.         if ([$2] == [*]) {/echo *** No patterns matching [$1] are on your global friends list}
  1146.         {/echo *** No patterns matching [$1] are on the list for channel mask $2 or the global list}
  1147.     }
  1148. }
  1149. # pp.rmlall <FRIENDS/ENEMIES> <umask>
  1150. alias pp.rmlall {
  1151.     EVAL ^foreach PP.$0 AB {
  1152.         if ((match($1 $PP[$0][$AB]))||(rmatch($1 $PP[$0][$AB]))) {^pp.rml $0 $1 $tolower($decode($AB))}
  1153.     }
  1154. }
  1155.  
  1156. # /friend <nick/umask> [<channel mask>]
  1157. # Snak adaptation 1.11 explained the parameters that the userhost -cmd gets
  1158. alias friend {
  1159.     if ([$0])
  1160.     {
  1161.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl FRIENDS $0 $1} {/pp.addl FRIENDS $0 *}}
  1162.         {
  1163.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1164.             
  1165.             # 0 is nick, 1 is +/- for oper, 2 is +/- for away, 3 is user, 4 is host
  1166.             ^Userhost $0 -CMD if ([$3]) 
  1167.             {
  1168.                 if ([$4] != [<UNKNOWN>])
  1169.                 {
  1170.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1171.                     ^pp.addl FRIENDS *!*$UHOST $AA
  1172.                     ^alias echo {}
  1173.                     ^pp.rml ENEMIES *!*$UHOST $AA
  1174.                     ^alias -echo
  1175.                     ^assign -UHOST
  1176.                     if (index(W $PP.SET) >= 0) 
  1177.                     {
  1178.                         //^notice $0 [PurePak] You have been added to my friends list for channels matching [${AA}]: type /ctcp $N HELP for functions available to you
  1179.                     }
  1180.                 } 
  1181.                 {
  1182.                     /echo *** $0 is not on IRC
  1183.                 }
  1184.             }
  1185.             {
  1186.                 /echo *** missing value returned for user in friend command (Snak)
  1187.             }
  1188.         }
  1189.     } {/echo *** /friend <nick/umask> [<channel mask>] (can contain wildcards)}
  1190. }
  1191. # /enemy <nick/umask> [<channel mask>]
  1192. alias enemy {
  1193.     if ([$0])
  1194.     {
  1195.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl ENEMIES $0 $1} {/pp.addl ENEMIES $0 *}}
  1196.         {
  1197.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1198.             ^Userhost $0 -CMD if ([$3]) {
  1199.                 if ([$4] != [<UNKNOWN>])
  1200.                 {
  1201.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1202.                     ^pp.addl ENEMIES *!*$UHOST $AA
  1203.                     ^alias echo {}
  1204.                     ^pp.rml FRIENDS *!*$UHOST $AA
  1205.                     ^alias -echo
  1206.                     ^assign -UHOST
  1207.                 } {/echo *** $0 is not on IRC}
  1208.             }
  1209.         }
  1210.     } {/echo *** /enemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1211. }
  1212.  
  1213. # /rmfriend <nick/umask> [<channel mask>]
  1214. alias rmfriend {
  1215.     if ([$0])
  1216.     {
  1217.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml FRIENDS $0 $1} {/pp.rmlall FRIENDS $0}}
  1218.         {
  1219.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1220.             ^Userhost $0 -CMD if ([$3]) {
  1221.                 if ([$4] != [<UNKNOWN>])
  1222.                 {
  1223.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1224.                     if (AA == [AA]) {^pp.rmlall FRIENDS *!*$UHOST} {^pp.rml FRIENDS *!*$UHOST $AA}
  1225.                     ^assign -UHOST
  1226.                 } {/echo *** $0 is not on IRC}
  1227.             }
  1228.         }
  1229.     } {/echo *** /rmfriend <nick/umask> [<channel mask>] (can contain wildcards)}
  1230. }
  1231. # /rmenemy <nick/umask> [<channel mask>]
  1232. alias rmenemy {
  1233.     if ([$0])
  1234.     {
  1235.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml ENEMIES $0 $1} {/pp.rmlall ENEMIES $0}}
  1236.         {
  1237.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1238.             ^Userhost $0 -CMD if ([$3]) {
  1239.                 if ([$4] != [<UNKNOWN>])
  1240.                 {
  1241.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1242.                     if (AA == [AA]) {^pp.rmlall ENEMIES *!*$UHOST} {^pp.rml ENEMIES *!*$UHOST $AA}
  1243.                     ^assign -UHOST
  1244.                 } {/echo *** $0 is not on IRC}
  1245.             }
  1246.         }
  1247.     } {/echo *** /rmenemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1248. }
  1249.  
  1250. alias nofriends {/rmfriend *!*@*}
  1251. alias noenemies {/rmenemy *!*@*}
  1252.  
  1253. alias lsfriends {
  1254.     echo *** Channel Mask   Patterns
  1255.     if (PP.FRIENDS.CK) {/echo *** [Global (*)]   $PP.FRIENDS.CK}
  1256.     foreach PP.FRIENDS AA {
  1257.         if (AA != [CK])
  1258.         {
  1259.             @ CM = tolower($decode($AA))
  1260.             echo *** $[14]CM $PP.FRIENDS[$AA]
  1261.         }
  1262.     }
  1263.     ^assign -CM
  1264. }
  1265. alias lsenemies {
  1266.     echo *** Channel Mask   Patterns
  1267.     if (PP.ENEMIES.CK) {/echo *** [Global (*)]   $PP.ENEMIES.CK}
  1268.     foreach PP.ENEMIES AA {
  1269.         if (AA != [CK])
  1270.         {
  1271.             @ CM = tolower($decode($AA))
  1272.             echo *** $[14]CM $PP.ENEMIES[$AA]
  1273.         }
  1274.     }
  1275.     ^assign -CM
  1276. }
  1277.  
  1278. # ----------------------------------------------------------------------------
  1279. # Miscellaneous user aliases
  1280. # ----------------------------------------------------------------------------
  1281.  
  1282. # pp.mmsg <PRIVMSG/NOTICE> <who status match> <msg>
  1283. alias pp.mmsg {
  1284.     @ STATP = [$1]
  1285.     ^on ^who * {^if (([$1] != N)&&(match($STATP $2))) {@ MSGNICKS = [$1 ]##MSGNICKS}}
  1286.     @ SEND_TYPE = [$0]
  1287.     @ SEND_MSG = [$2-]
  1288.     //^who *
  1289.     wait -CMD if (1) {
  1290.         ^on who -
  1291.         ^pp.listmsg $SEND_TYPE $MSGNICKS
  1292.         if (SEND_TYPE == [NOTICE])
  1293.         {
  1294.             @ EC.1 = [-]
  1295.             @ EC.2 = [-]
  1296.         }
  1297.         {
  1298.             @ EC.1 = [[]
  1299.             @ EC.2 = []]
  1300.         }
  1301.         if (STATP == [*@*]) {/echo -> ${EC.1}OPS@$C${EC.2} $SEND_MSG} {/echo -> ${EC.1}*@$C${EC.2} $SEND_MSG}
  1302.         ^assign -EC.1
  1303.         ^assign -EC.2
  1304.         ^assign -SEND_TYPE
  1305.         ^assign -SEND_MSG
  1306.         ^assign -MSGNICKS
  1307.         ^assign -STATP
  1308.     }
  1309. }
  1310.  
  1311. # Mass msg'ing aliases
  1312. alias msgall {^if ([$0]) {^pp.mmsg PRIVMSG * $*} {/echo *** /msgall <msg>}}
  1313. alias msgops {^if ([$0]) {^pp.mmsg PRIVMSG *@* $*} {/echo *** /msgops <msg>}}
  1314. alias wallops {^if ([$0]) {^pp.mmsg NOTICE *@* [WallOps:${C}] $*} {/echo *** /wallops <msg> (Use //wallops to use IRC's original wallops command)}}
  1315. alias wall {/wallops $*}
  1316.  
  1317. # So that help servers won't trigger flood protection
  1318. alias help {
  1319.     EVAL ^on -flood "$help_service *" {}
  1320.     EVAL ^timer 60 ^on flood - "$help_service *"
  1321.     //help $*
  1322. }
  1323.  
  1324. alias finger {
  1325.     if ([$0])
  1326.     {
  1327.         if (match(*@* $0)) {/exec $PP.SET.FINGERCMD $0}            
  1328.         {
  1329.             ^Userhost $0 -CMD if ([$3]) {^if ([$3] != [<UNKNOWN>]) {/exec $PP.SET.FINGERCMD $strip(~ $3)@$4} {/echo *** $0 is not on IRC}}
  1330.         }
  1331.     } {/echo *** /finger <nick> -or- /finger <user@host>}
  1332. }
  1333.  
  1334.  
  1335. alias names {^if ([$0]) {//names $*} {/if (ischannel($C)) {//names $C}}}
  1336. alias chops {^if ([$0]) {/who $0 -chops} {/who $C -chops}}
  1337.  
  1338. alias bk {
  1339.     if ([$0])
  1340.     {
  1341.         ^ban $0
  1342.         @ KN = [$0]
  1343.         ^assign KR $1-
  1344.         wait -CMD if (1) {
  1345.             //^kick $C $KN $KR
  1346.             ^assign -KN
  1347.             ^assign -KR
  1348.         }
  1349.     } {/echo *** /bk <nick> [<reason>]}
  1350. }
  1351.  
  1352. alias leave {^if ([$0]) {^if (ischannel($0)) {//leave $*} {//leave #$*}} {//leave $C}}
  1353. alias part {/leave $*}
  1354. alias join {^if ((ischannel($0))||(match(-* $0))) {//join $*} {//join #$*}}
  1355.  
  1356. # Yet another command that is destined to show up in tons of other scripts :)
  1357. # /avoid <nick> or /avoid - <nick> ... just /avoid displays a list
  1358. alias avoid {
  1359.     if ([$0])
  1360.     {
  1361.         if ([$0] == [-])
  1362.         {
  1363.             if ([$1])
  1364.             {
  1365.                 if (match($1 $PP.SET.AVOID))
  1366.                 {
  1367.                     ^delword $1 $PP.SET.AVOID
  1368.                     @ PP.SET.AVOID = NLIST
  1369.                     ^assign -NLIST
  1370.                     echo *** Nick $1 removed from avoidance list
  1371.                 }
  1372.                 {
  1373.                     if ([$1] == [*])
  1374.                     {
  1375.                         ^assign -PP.SET.AVOID
  1376.                         echo *** Avoidance list cleared
  1377.                     } {/echo *** Nick $1 is not on your avoidance list}
  1378.                 }
  1379.             } {/echo *** /avoid - <nick>}
  1380.         }
  1381.         {
  1382.             if (match($0 $PP.SET.AVOID)) {/echo *** Nick $0 is already on your avoidance list}
  1383.             {
  1384.                 @ PP.SET.AVOID = PP.SET.AVOID##[$0 ]
  1385.                 echo *** Nick $0 added to avoidance list
  1386.                 ^notify $0
  1387.             }
  1388.         }
  1389.     } {/echo *** Avoidance list: $PP.SET.AVOID}
  1390. }
  1391.  
  1392. alias cstats {
  1393.     @ CSOPS = 0
  1394.     @ CSNOPS = 0
  1395.     @ CSOPERS = 0
  1396.     @ CSHERE = 0
  1397.     @ CSGONE = 0
  1398.     @ CSUCOUNT = 0
  1399.     @ CSFARTHEST = 0
  1400.     ^on ^who * {
  1401.         if (match(*@* $2)) {@ CSOPS = CSOPS + 1} {@ CSNOPS = CSNOPS + 1}
  1402.         if ((mid(1 1 $2) == [*])||(mid(2 1 $2) == [*])) {@ CSOPERS = CSOPERS + 1}
  1403.         if (match(*H* $2)) {@ CSHERE = CSHERE + 1} {@ CSGONE = CSGONE + 1}
  1404.         @ CSUCOUNT = CSUCOUNT + 1
  1405.         if ([$5] > CSFARTHEST) {@ CSFARTHEST = [$5]}
  1406.     }
  1407.     if (ischannel($0)) {@ CSCHAN = [$0]} {@ CSCHAN = C}
  1408.     //^who $CSCHAN
  1409.     wait -CMD if (1) {
  1410.         ^on who -
  1411.         echo *** Stats for channel ${CSCHAN}:
  1412.         echo *** Total Users:${CSUCOUNT}   Ops:${CSOPS}   Non-ops:${CSNOPS}   IRCOps:${CSOPERS}
  1413.         echo *** Here:${CSHERE}   Away:${CSGONE}   Server hops to farthest user:${CSFARTHEST}
  1414.         ^assign -CSOPS
  1415.         ^assign -CSNOPS
  1416.         ^assign -CSCHAN
  1417.         ^assign -CSOPERS
  1418.         ^assign -CSHERE
  1419.         ^assign -CSGONE
  1420.         ^assign -CSUCOUNT
  1421.         ^assign -CSFARTHEST
  1422.     }
  1423. }
  1424.  
  1425. alias version {
  1426.     if ([$0]) {^if (match(*.* $0)) {//version $*} {//ctcp $0 VERSION}}
  1427.     {
  1428.         //version
  1429.         echo *** PurePak: version $PPVERS
  1430.     }
  1431. }
  1432.  
  1433. alias rwhois {^if ([$0]) {/whois $0 $0} {/whois $N}}
  1434. alias whois {
  1435.     @ WHOISINPROGRESS = 1
  1436.     //whois $*
  1437.     wait -CMD if (1) {^timer 2 ^assign -WHOISINPROGRESS}
  1438. }
  1439.  
  1440. # /nslookup <nick> or /nslookup <ip address>
  1441. #alias nslookup {
  1442. #    if ([$0])
  1443. #    {
  1444. #        if (match(*.* $0)) {^pp.dolookup $0}
  1445. #        {
  1446. #            ^Userhost $0 -CMD if ([$3]) {
  1447. #                if ([$4] != [<UNKNOWN>])
  1448. #                {
  1449. #                    if (!isalpha($4)) {^pp.dolookup $4}
  1450. #                    {/echo *** $0 is not online as an IP address}
  1451. #                } {/echo *** $0 is not on IRC}
  1452. #            }
  1453. #        }
  1454. #    } {/echo *** /nslookup <nick> -or- /nslookup <ip address>}
  1455. #}
  1456. #alias pp.dolookup {
  1457. #    if (!LOOKINGUP)
  1458. #    {
  1459. #        exec -name NSLOOKUP $PP.SET.NSLOOKCMD $0
  1460. #        @ IPAD = [$0]
  1461. #        @ LOOKINGUP = 1
  1462. #    }
  1463. #}
  1464. #on ^exec "NSLOOKUP *" {}
  1465. #on ^exec_error "NSLOOKUP *" {}
  1466. #on ^exec "NSLOOKUP *Name*" {^pp.gn $*}
  1467. #on ^exec_error "NSLOOKUP *Name*" {^pp.gn $*}
  1468. #on ^exec_exit "NSLOOKUP *" {
  1469. #    if (NSHOST) {/echo *** $IPAD is ${NSHOST}} {/echo *** Could not resolve a hostname for $IPAD}
  1470. #    ^assign -NSHOST
  1471. #    ^assign -IPAD
  1472. #    ^assign -LOOKINGUP
  1473. #}
  1474.  
  1475. alias pp.gn {
  1476.     @ AA = 0
  1477.     while (word($AA $*))
  1478.     {
  1479.         if (match(*.* $word($AA $*))) {@ NSHOST = word($AA $*)}
  1480.         @ AA = AA + 1
  1481.     }
  1482. }
  1483.  
  1484. alias ig {
  1485.     if ([$0])
  1486.     {
  1487.         ^Userhost $0 -CMD if ([$3]) {
  1488.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 MSG NOTICE CTCP PUBLIC} {/echo *** $0 is not on IRC}
  1489.         }
  1490.     } {/echo *** /ig <nick>}
  1491. }
  1492. alias unig {
  1493.     if ([$0])
  1494.     {
  1495.         ^Userhost $0 -CMD if ([$3]) {
  1496.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 NONE} {/echo *** $0 is not on IRC}
  1497.         }
  1498.     } {/echo *** /unig <nick>}
  1499. }
  1500.  
  1501. alias serv {//server $*}
  1502. alias umode {//mode $N $*}
  1503.  
  1504.  
  1505. alias massinv {
  1506.     if ([$0])
  1507.     {
  1508.         ^on ^who * {
  1509.             if (([$1] != N)&&([$0] != C)) {/EVAL ^timer $rand(30) //invite $1 $C}
  1510.         }
  1511.         echo *** Inviting users found with command '/who $*' to channel $C
  1512.         //^who $*
  1513.         wait -CMD ^on who -
  1514.     } {/echo *** /massinv <who params>   - Where <who params> is exactly as if it were a /who command.}
  1515. }
  1516.     
  1517. alias cycle {lj}
  1518. alias lj {
  1519.     @ OC = C
  1520.     //leave $C
  1521.     wait -CMD if (1) {
  1522.         //join $OC
  1523.         ^assign -OC
  1524.     }
  1525. }
  1526.  
  1527. alias signoff {
  1528.     if ([$0])
  1529.     {
  1530.         echo *** Signoff: $N \($*\)
  1531.         //signoff $*
  1532.     }
  1533.     {
  1534.         echo *** Signoff: $N \(Leaving\)
  1535.         //signoff Leaving
  1536.     }
  1537. }
  1538. alias exit {/signoff $*}
  1539. alias quit {/signoff $*}
  1540. alias bye {/signoff $*}
  1541.  
  1542. # Snak adaptation 1.11 remove unnecessary functions rm
  1543. alias ls {/exec $PP.SET.LSCMD $*}
  1544. alias lsw {
  1545.     @ OLDTABMAX = TAB_MAX
  1546.     ^set TAB_MAX 64
  1547.     exec -name lsw $PP.SET.LSWCMD $*
  1548.     wait -CMD %lsw if (1) {
  1549.         ^set TAB_MAX $OLDTABMAX
  1550.         ^assign -OLDTABMAX
  1551.     }
  1552. }
  1553.  
  1554.  
  1555. # alias rm {^if ([$0]) {/exec $PP.SET.RMCMD $*} {/echo *** /rm [<rm options>] <filenames>}}
  1556. alias cat {^if ([$0]) {/exec $PP.SET.CATCMD $*} {/echo *** /cat <filename>}}
  1557. on ^exec "MSGCAT *" {
  1558.     if (!match(=* $MCAT))
  1559.     {
  1560.         ^timer $MCATCTR //msg $MCAT $1-
  1561.         @ MCATCTR = MCATCTR + (rand(2) + 1)
  1562.     } {//msg $MCAT $1-}
  1563. }
  1564. on ^exec_exit "MSGCAT *" {
  1565.     ^assign -MCAT
  1566.     ^assign -MCATCTR
  1567. }
  1568. alias catto {
  1569.     if ([$1])
  1570.     {
  1571.         @ MCAT = [$0]
  1572.         @ MCATCTR = 2
  1573.         exec -name MSGCAT $PP.SET.CATCMD $1
  1574.     }
  1575.     {^if ([$0]) {/catto $C $0} {/echo *** /catto <nick/channel> <file> -or- /catto <file> (goes to current channel)}}
  1576. }
  1577. alias ps {/exec $PP.SET.PSCMD $*}
  1578. alias pskill {^if ([$0]) {/exec $PP.SET.KILLCMD $*} {/echo *** /pskill <pid(s) to kill>}}
  1579.  
  1580. alias pp.awaylog {
  1581.     ^assign AWAYLOG[$PP.AWAYLCTR] $*
  1582.     @ PP.AWAYLCTR = PP.AWAYLCTR + 1
  1583. }
  1584. alias pp.pe {/echo $*}
  1585.  
  1586. alias pp.playback {
  1587.     if ([$1] == [MSG]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] [$3!$strip(~ $2)] $4-}
  1588.     if ([$1] == [NOTICE]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] -$3!$strip(~ $2)- $4-}
  1589.     if ([$1] == [KICK]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] Kicked from $4 by $3 [$strip(~ $2)] \($5-\)}
  1590.     if ([$1] == [BAN]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] banned you from $4 with bans: $5-}
  1591.     if ([$1] == [FLOOD]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $4- from $3 [$strip(~ $2)] detected}
  1592.     if ([$1] == [DEOP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] deopped you on $4}
  1593.     if ([$1] == [OP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] opped you on $4}
  1594.     if ([$1] == [DCC]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] DCC $4 \($5\) received from $2 [$strip(~ $3)]}
  1595. }
  1596. alias playback {
  1597.     if (AWAYLOG[0])
  1598.     {
  1599.         @ CTR = 0
  1600.         while (CTR <= PP.AWAYLCTR)
  1601.         {
  1602.             ^pp.playback $AWAYLOG[$CTR]
  1603.             @ CTR = CTR + 1
  1604.         }
  1605.         ^assign -CTR
  1606.     } {/echo *** No messages or events to play back}
  1607. }
  1608. alias clearlog {
  1609.     foreach AWAYLOG AA {^assign -AWAYLOG[$AA]}
  1610.     @ PP.AWAYLCTR = 0
  1611.     echo *** Away log is now empty
  1612. }
  1613.             
  1614. alias away {
  1615.     if (!(A))
  1616.     {
  1617.         if ([$0]) {//away $*}
  1618.         {
  1619.             if (index(G $PP.SET) >= 0) {//away All messages will be logged...} {//away Gone...}
  1620.         }
  1621.         wait -CMD if (1) {
  1622.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  1623.             {
  1624.                 ^assign SEND_MSG ACTION is away: ${A}
  1625.                 ^pp.listmsg PRIVMSG $mychannels()
  1626.                 ^assign -SEND_MSG
  1627.                 echo * $N is away: $A
  1628.             }
  1629.         }
  1630.         @ PP.AWAYSINCE = Z
  1631.     }
  1632.     {
  1633.         //away
  1634.         wait -CMD if (1) {
  1635.             ^assign -PP.AWAYSINCE
  1636.             if (index(G $PP.SET) >= 0) {/echo *** Type /playback to play back away log, type /clearlog to clear away log.}
  1637.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  1638.             {
  1639.                 ^assign SEND_MSG ACTION is back.
  1640.                 ^pp.listmsg PRIVMSG $mychannels()
  1641.                 ^assign -SEND_MSG
  1642.                 echo * $N is back.
  1643.             }
  1644.         }
  1645.     }
  1646. }
  1647.  
  1648. # paway <nick> <msg/->
  1649. alias paway {
  1650.     if ([$0])
  1651.     {
  1652.         if ([$1])
  1653.         {
  1654.             if ([$1] == [-])
  1655.             {
  1656.                 ^assign -PP.PAWAYS[$encode($toupper($0))]
  1657.                 echo *** Personal away message for $0 removed
  1658.             }
  1659.             {
  1660.                 @ PP.PAWAYS[$encode($toupper($0))] = [$1-]
  1661.                 echo *** Personal away message for $0 added: $1-
  1662.             }
  1663.         }
  1664.         {
  1665.             if (PP.PAWAYS[$encode($toupper($0))]) {/echo *** Personal away message for $0: $PP.PAWAYS[$encode($toupper($0))]}
  1666.             {/echo *** No personal away message set for $0}
  1667.         }
  1668.     }
  1669.     {
  1670.         echo *** Nick       Message
  1671.         foreach PP.PAWAYS AA {/echo *** $[10]decode($AA) $PP.PAWAYS[$AA]}
  1672.     }
  1673. }
  1674.  
  1675. alias sve {
  1676.  
  1677.     # Snak adaptation 1.11 use the new delete, open, close and write functions
  1678.     @ LF = [${HOME}/Purepak/$PP.SAVEFILE]
  1679.     
  1680.     @res = delete($LF)
  1681.     
  1682.     @ FHANDLE = open($LF w)
  1683.     
  1684.     if (FHANDLE > 0)
  1685.     {
  1686.         @res = write( $FHANDLE # PurePak version $PPVERS saved settings file )
  1687.         @res = write( $FHANDLE # Written $stime($time()) )
  1688.         foreach PP.SET AA {@res = write( $FHANDLE @ PP.SET.$AA = [$PP.SET[$AA]] )}
  1689.         foreach PP.PAWAYS AA {@res = write( $FHANDLE @ PP.PAWAYS.$AA = [$PP.PAWAYS[$AA]] )}
  1690.         @res = write( $FHANDLE @ PP.SET = [$PP.SET] )
  1691.         @res = write( $FHANDLE ^set flood_rate $flood_rate )
  1692.         @res = write( $FHANDLE ^set flood_after $flood_after )
  1693.         @res = write( $FHANDLE ^set shell $shell )
  1694.         @res = write( $FHANDLE ^set suppress_server_motd $suppress_server_motd )
  1695.         foreach PP.FRIENDS AA {@res = write( $FHANDLE @ PP.FRIENDS[$AA] = [$PP.FRIENDS[$AA]] )}
  1696.         foreach PP.ENEMIES AA {@res = write( $FHANDLE @ PP.ENEMIES[$AA] = [$PP.ENEMIES[$AA]] )}
  1697.         #@res = write( $FHANDLE ^pp.savedfrom $strip(.ba $PPVERS) )
  1698.         @res = write( $FHANDLE echo *** Saved settings loaded from $LF )
  1699.  
  1700.         @res = close($FHANDLE)
  1701.         
  1702.         echo *** Current settings saved to $LF
  1703.     }
  1704.     {
  1705.         echo *** Could not open $LF
  1706.     }
  1707.     ^assign -LF
  1708.     ^assign -FHANDLE
  1709. }
  1710.  
  1711. alias pp.savedfrom {
  1712. #    if ([$0] < 109)
  1713. #    {
  1714. #        ^alias echo {}
  1715. #        foreach FRIENDS AA {
  1716. #            ^pp.addl FRIENDS $FRIENDS[$AA] *
  1717. #            ^assign -FRIENDS[$AA]
  1718. #        }
  1719. #        foreach ENEMIES AA {
  1720. #            ^pp.addl ENEMIES $ENEMIES[$AA] *
  1721. #            ^assign -ENEMIES[$AA]
  1722. #        }
  1723. #        ^alias -echo
  1724. #        ^timer 30 /echo *** Your old friends/enemies lists from your previous version of PurePak have been added to the 'global' friends/enemies lists in this version.  You should /sve now to save the lists in the new format. (Type /lsfriends and /lsenemies to check your lists)
  1725. #    }
  1726. #    if ([$0] < 205)
  1727. #    {
  1728. #        foreach PP.PAWAYS AA {
  1729. #            @ PP.PAWAYS[$encode($toupper($AA))] = PP.PAWAYS[$AA]
  1730. #            ^assign -PP.PAWAYS[$AA]
  1731. #            ^timer 30 /echo *** There have been changes to the saved file format.  Auto-converted, but you should /sve now so you don't see this message again.
  1732. #        }
  1733. #    }
  1734. #    ^timer 5 ^alias -pp.savedfrom
  1735. }
  1736.  
  1737. # So the "IRC log started ..." comments in the logfile do nothing
  1738. alias IRC {}
  1739. alias pphelp {
  1740.     if ([$0]) {
  1741.         if (!(PPHELP.HELP)) 
  1742.         {
  1743.             //^load purepak.hlp
  1744.             if (!(PPHELP.HELP)) {/echo *** Error loading purepak.hlp: check to make sure that the file exists and is in a directory where it can be found.} {/pphelp $*}
  1745.         }
  1746.         {
  1747.             @ PP.HELPLASTUSED = time()
  1748.             if ([$1]) {@ EN = [$0_$1]} {@ EN = [$0]}
  1749.             if (!(PPHELP[$EN][0])) {/echo *** No help available on '$*'}
  1750.             {
  1751.                 echo *** Help: $*
  1752.                 foreach PPHELP.$EN AA {/echo -- $PPHELP[$EN][$AA]}
  1753.                 echo --
  1754.             }
  1755.             ^assign -EN
  1756.         }
  1757.     } {/pphelp HELP}
  1758. }
  1759.  
  1760. alias lockmode {
  1761.     if ([$0])
  1762.     {
  1763.         if (!ischannel($0)) {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  1764.         {
  1765.             if ([$1])
  1766.             {
  1767.                 if ([$1] == [OFF])
  1768.                 {
  1769.                     if (!(LOCKEDMODES[$encode($0)])) {/echo *** No modes are locked on $0}
  1770.                     {
  1771.                         ^assign -LOCKEDMODES[$encode($0)]
  1772.                         if (gotops($0))
  1773.                         {
  1774.                             if (index(W $PP.SET) >= 0)
  1775.                             {
  1776.                                 if ([$0] == C) {/me : Mode no longer locked} {/describe $0 : Mode no longer locked}
  1777.                             }
  1778.                         }
  1779.                         echo *** Mode on channel $0 no longer locked
  1780.                     }
  1781.                 }
  1782.                 {
  1783.                     if (rmatch($1 *-* *o* *v*)) {/echo *** Cannot lock that mode.  /pphelp lockmode for help.}
  1784.                     {
  1785.                         ^assign LOCKEDMODES[$encode($0)] $1-
  1786.                         if (gotops($0))
  1787.                         {
  1788.                             if (index(W $PP.SET) >= 0)
  1789.                             {
  1790.                                 if ([$0] == C) {/me : Mode locked to: $1-} {/describe $0 : Mode locked to: $1-}
  1791.                             }
  1792.                             ^clearmode $0
  1793.                             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  1794.                         } {/echo *** Warning: you don't have ops on $0!}
  1795.                         echo *** Mode on channel $0 locked to: $1-
  1796.                     }
  1797.                 }
  1798.             } {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  1799.         }
  1800.     }
  1801.     {
  1802.         echo *** Channels/modes currently locked:
  1803.         foreach LOCKEDMODES AA {/echo *** Channel: $decode($AA)   Mode: $LOCKEDMODES[$AA]}
  1804.     }
  1805. }
  1806.  
  1807. alias pp.last {/sendto $0 [$2!$strip(~ $1)] $3-}
  1808. alias pp.lastn {/sendto $0 -$2!$strip(~ $1)- $3-}
  1809. # User /last and /lastn commands
  1810. alias last {^if ([$0]) {/pp.last $0 $PP.LMSG} {/pp.last $C $PP.LMSG}}
  1811. alias lastn {^if ([$0]) {/pp.lastn $0 $PP.LNOTICE} {/pp.lastn $C $PP.LNOTICE}}
  1812.  
  1813. # ----------------------------------------------------------------------------
  1814. # Standard on handlers
  1815. # ----------------------------------------------------------------------------
  1816.  
  1817. # Don't show error notices from deop*4's from old servers
  1818. on ^401 "% % No such nick (channel)" {}
  1819.  
  1820. # Make names look like it does when you join a channel
  1821. on ^names * {/echo *** Users on $0: $1-}
  1822.  
  1823. # Checks to see if a message contains any known floods
  1824. alias pp.fp.msgsafe {
  1825.  
  1826.     @ FUNCTION_RETURN = 1
  1827.     if (index(F $PP.SET) >= 0)
  1828.     {
  1829.         if (match(**** $*)) {@ FUNCTION_RETURN = 0}
  1830.         {
  1831.             ^if (rindex($right(1 $0) $0) >= PP.SET.JFLEN) {@ FUNCTION_RETURN = 0}
  1832.             {
  1833.                 ^if (left(10 $*) == [         ]) {@ FUNCTION_RETURN = 0}
  1834.             }
  1835.         }
  1836.     }
  1837. }
  1838.  
  1839. # Public flood/tsunami filters
  1840. alias pp.fp.pubecho {^if ([$1] == C) {/echo <$0> $2-} {/echo <$0:$1> $2-}}
  1841. on ^public "% % *****" {
  1842.     if (index(F $PP.SET) >= 0) {/pp.fp.pubecho $0 $1 [flood detected]} {/pp.fp.pubecho $*}
  1843.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  1844. }
  1845. on ^public_notice "% % *****" {
  1846.     if (index(F $PP.SET) >= 0) {/echo -$0:${1}- [flood detected]} {/echo -$0:${1}- $2-}
  1847.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  1848. }
  1849. on ^public_msg "% % *****" {
  1850.     if (index(F $PP.SET) >= 0) {/echo \($0/$1\) [flood detected]} {/echo \($0/$1\) $2-}
  1851.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  1852. }
  1853.  
  1854. # Msg and notice handlers
  1855. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  1856. # removed ^ to let Snak process the message
  1857. on msg * {
  1858.     ^assign PP.LMSG $USERHOST() $*
  1859.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  1860.     {
  1861.         if ((index(W $PP.SET) >= 0)&&(!match($0 $LAWAYN)))
  1862.         {
  1863.             if ([$0] != N) 
  1864.             {
  1865.                 if (!PP.PAWAYS[$encode($toupper($0))]) {//^notice $0 [PurePak] I am away... Messages are being logged  [since ${PP.AWAYSINCE}]}
  1866.                 {
  1867.                     //^notice $0 [AWAY] $PP.PAWAYS[$encode($toupper($0))]  [since ${PP.AWAYSINCE}]
  1868.                 }
  1869.             }
  1870.             if (!(LAWAYN)) 
  1871.             {
  1872.                 ^timer 120 ^assign -LAWAYN
  1873.             }
  1874.             @ LAWAYN = [$0 ]##LAWAYN
  1875.         }
  1876.         ^pp.awaylog $time() MSG $USERHOST() $*
  1877.     }
  1878. }
  1879. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  1880. # removed ^ to let Snak process the message
  1881. on notice * {
  1882.     @ PP.LNOTICE = [$USERHOST() $*]
  1883.     if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() NOTICE $USERHOST() $*}
  1884. }
  1885.  
  1886. # Make some notices look better and be more informative
  1887. on ^482 * {^if ([$0] != S) {/echo *** You are desynched on $1 \(from server $0\)} {/echo *** You are not channel operator on $1}}
  1888. on ^442 * {^if ([$0] != S) {^if (match($1 $mychannels())) {/echo *** You are desynched: server $0 doesn't think you are on channel $1} {/echo *** You are not on channel $1 \(from server $0\)}} {/echo *** You are not on channel $1}}
  1889. on ^465 * {/echo *** You are banned (K-lined) from server $0}
  1890.  
  1891. # Snak adaptation 1.7 Removed
  1892. # on ^333 * {^if (!match(*.* $2)) {/echo *** Topic was set on $1 by $2 at $stime($3)}}
  1893. on ^375 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo ++ $1-}}
  1894. on ^372 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo -- $1-}}
  1895. on ^376 * {@ PP.SEENMOTD = 1}
  1896. EVAL ^if (PP.EPIC) {
  1897.     on ^323 * {}
  1898.     on ^376 * {}
  1899.     on ^219 * {}
  1900. }
  1901.  
  1902. # Snak adaptation 1.1 Removed
  1903. # on ^leave * {/xecho -level CRAP *** $0 has left channel $1}
  1904. # on ^channel_signoff * {/xecho -level CRAP *** Signoff: $1 \($2-\) [$0]}
  1905.  
  1906. # Suppress annoying (and meaningless) "dgets timed out" notices
  1907. on ^window "% ??? *dgets timed out.*continuing*" {}
  1908. # And there's a typo in the client too!
  1909. on ^window "% ??? *dgets tiomed out.*continuing*" {}
  1910.  
  1911. # Don't show notices that you are away unless /whois'ing yourself
  1912. on ^window "% ??? % is away: *" {^if (([$2] != N)||(WHOISINPROGRESS)) {/echo $1-}}
  1913.  
  1914. # Anything to be done on join, like friends/enemies list checking
  1915. on #-join 2 * {
  1916.     if (gotops($1))
  1917.     {
  1918.         if (index(L $PP.SET) >= 0)
  1919.         {
  1920.             if (ispal($0!$USERHOST() $1))
  1921.             {
  1922.                 ^timer 2 /echo *** $0 is on your friends list: auto-opping on $1
  1923.                 //mode $1 +o $0
  1924.             }
  1925.         }
  1926.         if (index(E $PP.SET) >= 0)
  1927.         {
  1928.             if (isshit($0!$USERHOST() $1))
  1929.             {
  1930.                 ^timer 2 /echo *** $0 is on your enemies list: auto-bkicking off $1
  1931.                 //mode $1 -o+b $0 *!*$mid(1 1000 $USERHOST())
  1932.                 //kick $1 $0 [Auto-BKick]
  1933.             }
  1934.         }
  1935.         if ((index(C $PP.SET) >= 0)&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  1936.         {
  1937.             @ JHOST = mid(${index(@ $USERHOST())+1} $rindex($right(1 $USERHOST()) $USERHOST()) $USERHOST())
  1938.             if ([$JHOST$1] == LASTJHOST)
  1939.             {
  1940.                 @ PP.CPCTR = PP.CPCTR + 1
  1941.                 if (PP.CPCTR >= PP.SET.CPSENS)
  1942.                 {
  1943.                     //mode $1 +b *!*@$JHOST
  1944.                     wait -CMD ^pp.mkick $1 *@$JHOST [Clonebots Detected]
  1945.                     echo *** Clonebot mass-join protection engaged on $1 for bots at ${JHOST}
  1946.                     @ PP.CPCTR = 0
  1947.                 }
  1948.             }
  1949.             if (!(LASTJHOST))
  1950.             {
  1951.                 ^timer 4 ^assign -LASTJHOST
  1952.                 ^timer 4 @ PP.CPCTR = 0
  1953.             }
  1954.             @ LASTJHOST = JHOST##[$1]
  1955.             ^assign -JHOST
  1956.         }
  1957.     }
  1958. #    if ((PP.SET.LOOKJOIN)&&(!LOOKINGUP))
  1959. #    {
  1960. #        if (!isalpha($mid(${index(@ $USERHOST())+1} 1000 $USERHOST())))
  1961. #        {
  1962. #            ^nslookup $mid(${index(@ $USERHOST())+1} 1000 $USERHOST())
  1963. #        }
  1964. #    }
  1965.     if (match($0 $PP.SET.AVOID))
  1966.     {
  1967.         echo *** Automatic avoiding engaged for $0: setting away
  1968.         if (!(A))
  1969.         {
  1970.             if (index(O $PP.SET) >= 0)
  1971.             {
  1972.                 @ OLD_PPSET = PP.SET
  1973.                 @ PP.SET = strip(O $PP.SET)
  1974.                 ^away bbl...
  1975.                 wait -CMD if (1) {
  1976.                     @ PP.SET = OLD_PPSET
  1977.                     ^assign -OLD_PPSET
  1978.                 }
  1979.             } {^away bbl...}
  1980.         }
  1981.     }
  1982. }
  1983.     
  1984. on -raw_irc "% KICK *" {
  1985.     ^assign KNICK $nickonly($0)
  1986.     if ([$3] == N)
  1987.     {
  1988.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() KICK $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $KNICK $2 $strip(: $4) $5-}
  1989.         if (index(J $PP.SET) >= 0) {/EVAL ^timer 2 //^quote JOIN $2}
  1990.     }
  1991.     if ((index(M $PP.SET) >= 0)&&(gotops($2)))
  1992.     {
  1993.         if (([$0$2] == LASTKICKER)&&(!rand(4)))
  1994.         {
  1995.             if (!PP.SET.MASSRESP)
  1996.             {
  1997.                 //mode $2 -o $KNICK
  1998.                 if (index(W $PP.SET) >= 0) {^notice $KNICK [PurePak] Masskick on channel $2 from you detected}
  1999.             } {//kick $2 $KNICK [Masskick detected]}
  2000.             echo *** Masskick protection activated by ${KNICK} on $2
  2001.         }
  2002.         if (KNICK != N)
  2003.         {
  2004.             if (!(LASTKICKER)) {^timer 3 ^assign -LASTKICKER}
  2005.             @ LASTKICKER = [$0$2]
  2006.         }
  2007.     }
  2008.     if (PP.BOTS) {/bots.onkick $*}
  2009.     ^assign -KNICK
  2010. }
  2011.  
  2012. # Way too much crap is done here :P
  2013. on -mode "% #% *" {
  2014.     if ((index(M $PP.SET) >= 0)&&([$0] != N))
  2015.     {
  2016.         if ((gotops($1))&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2017.         {
  2018.             if ((rmatch($2 *-ooo* *+o-o+o* *-o+o-o*))&&([$0] != LASTMASSER))
  2019.             {
  2020.                 if (!PP.SET.MASSRESP)
  2021.                 {
  2022.                     //mode $1 -o $0
  2023.                     if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2024.                 } {//kick $1 $0 [Massdeop detected]}
  2025.                 echo *** Massdeop protection activated by $0 on $1
  2026.                 ^assign LASTMASSER $0
  2027.                 ^timer 10 ^assign -LASTMASSER
  2028.             }
  2029.             {
  2030.                 if (match(*-o* $2))
  2031.                 {
  2032.                     if (([$0$1] == LASTDEOP)&&([$0] != LASTMASSER))
  2033.                     {
  2034.                         if (!PP.SET.MASSRESP)
  2035.                         {
  2036.                             //mode $1 -o $0
  2037.                             if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2038.                         } {//kick $1 $0 [Massdeop detected]}
  2039.                         echo *** Massdeop protection activated by $0 on $1
  2040.                         ^assign LASTMASSER $0
  2041.                         ^timer 10 ^assign -LASTMASSER
  2042.                     }
  2043.                     if (!(LASTDEOP)) {^if (match(*-oo* $2)) {^timer 4 ^assign -LASTDEOP} {^timer 2 ^assign -LASTDEOP}}
  2044.                     ^assign LASTDEOP $0$1
  2045.                 }
  2046.             }
  2047.         }
  2048.     }
  2049.     if ((match(*.* $0))&&(index(S $PP.SET) >= 0))
  2050.     {
  2051.         if ((match(*+o* $2))&&(gotops($1)))
  2052.         {
  2053.             if ((!match(*@* $3))&&(isalpha($3))) {^if (!ispal($3!$getuh($3) $1)) {@ SERVOPD = [$3]} {@ EXCLUDED = [$3]}}
  2054.             if ([$4]) {^if ((!match(*@* $4))&&(isalpha($4))) {^if (!ispal($4!$getuh($4) $1)) {^assign SERVOPD $4 $SERVOPD} {^assign EXCLUDED $4 $EXCLUDED}}}
  2055.             if ([$5]) {^if ((!match(*@* $5))&&(isalpha($5))) {^if (!ispal($5!$getuh($5) $1)) {^assign SERVOPD $5 $SERVOPD} {^assign EXCLUDED $5 $EXCLUDED}}}
  2056.             if ([$6]) {^if ((!match(*@* $6))&&(isalpha($6))) {^if (!ispal($6!$getuh($6) $1)) {^assign SERVOPD $6 $SERVOPD} {^assign EXCLUDED $6 $EXCLUDED}}}
  2057.             if ([$7]) {^if ((!match(*@* $7))&&(isalpha($7))) {^if (!ispal($7!$getuh($7) $1)) {^assign SERVOPD $7 $SERVOPD} {^assign EXCLUDED $7 $EXCLUDED}}}
  2058.             //mode $1 -oooo $SERVOPD
  2059.             if (SERVOPD) {/echo *** Server ops protection engaged on channel $1 for: ${SERVOPD}}
  2060.             if (EXCLUDED) {/echo *** These users are on your friends list and were excluded from server ops protection: ${EXCLUDED}}
  2061.             if ((index(W $PP.SET) >= 0)&&(!!(SERVOPD)))
  2062.             {
  2063.                 ^assign SEND_MSG [PurePak] Server ops from $0 to you on $1 detected, removed.
  2064.                 ^pp.listmsg NOTICE $SERVOPD
  2065.                 ^assign -SEND_MSG
  2066.             }
  2067.             ^assign -EXCLUDED
  2068.             ^assign -SERVOPD
  2069.         }
  2070.     }
  2071.     if (match(*+b* $2))
  2072.     {
  2073.         ^assign CHECKSTR ${N}!$PP.UHOST
  2074.         if (rmatch($CHECKSTR $3-))
  2075.         {
  2076.             if ([$0] == N) {/echo *** Warning: You just placed a ban on yourself on $1!}
  2077.             {
  2078.                 if (match($3 $CHECKSTR)) {@ MYBANS = [$3]}
  2079.                 if (match($4 $CHECKSTR)) {@ MYBANS = [$4 $MYBANS]}
  2080.                 if (match($5 $CHECKSTR)) {@ MYBANS = [$5 $MYBANS]}
  2081.                 if (match($6 $CHECKSTR)) {@ MYBANS = [$6 $MYBANS]}
  2082.                 ^pp.banprot $0 $1 $MYBANS
  2083.                 if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() BAN $USERHOST() $0 $1 $MYBANS}
  2084.                 ^assign -MYBANS
  2085.             }
  2086.         }
  2087.         ^assign -CHECKSTR
  2088.     }
  2089.     if ((index(K $PP.SET) >= 0)&&(match(*+k* $2)))
  2090.     {
  2091.         if ((match(** $3-))||(match(** $3-)))
  2092.         {
  2093.             ^set status_mode  *\(+k$M\)
  2094.             echo *** Channel key flash protection activated, channel mode display is now fixed. Normal mode display will resume when key is removed.
  2095.             EVAL ^on -mode "% $1 %-k% *" {
  2096.                 ^timer 2 ^set status_mode  (+%+)
  2097.                 EVAL ^on mode - "% $1 %-k% *"
  2098.             }
  2099.             if ((gotops($1))&&([$0] != N)) {//mode $1 -kkkk $3-}
  2100.         }
  2101.     }
  2102.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2103.     {
  2104.         if ((match(*-o* $2))&&(match($N $3-))) {^timer 2 ^pp.dopcheck $USERHOST() $0 $1}
  2105.         if ((match(*+o* $2))&&(match($N $3-))) {^timer 2 ^pp.opcheck $USERHOST() $0 $1}
  2106.     }
  2107.     if ((!!(LOCKEDMODES[$encode($1)]))&&([$0] != N))
  2108.     {
  2109.         if ((rmatch($2 *i* *n* *s* *t* *p* *l* *k*))&&(gotops($1)))
  2110.         {
  2111.             clearmode $1
  2112.             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2113.             if (index(W $PP.SET) >= 0)
  2114.             {
  2115.                 if ([$1] == C) {^me : Mode is locked to: $LOCKEDMODES[$encode($1)]} {^describe $1 : Mode is locked to: $LOCKEDMODES[$encode($1)]}
  2116.             }
  2117.         }
  2118.     }
  2119. }
  2120. alias pp.dopcheck {^if (!gotops($2)) {^pp.awaylog $time() DEOP $*}}
  2121. alias pp.opcheck {^if (gotops($2)) {^pp.awaylog $time() OP $*}}
  2122. alias pp.banprot {
  2123.     if ((gotops($1))&&(index(B $PP.SET) >= 0))
  2124.     {
  2125.         //mode $1 -o $0
  2126.         ^pp.listunban $1 $2-
  2127.         if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Ban protection activated on channel $1 by ban\(s\): $2-}
  2128.         echo *** Ban protection activated by $0 on $1
  2129.     }
  2130. }
  2131.  
  2132. # Flood auto-ignoring
  2133. on -flood "% MSG *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2134. on -flood "% NOTICE *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2135. on #^ctcp 4 * {
  2136.     if (!rmatch($2 DCC XDCC *INFO UTC PING FINGER VER* ECHO TIME ACTION ERRMSG SED HELP OP* INVITE* UNBAN* LC PAGE))
  2137.     {
  2138.         if (pp.fp.msgsafe($2-))
  2139.         {
  2140.             if (ischannel($1)) {/echo *** Unknown CTCP $2 from $0 to $1: $3-}
  2141.             {/echo *** Unknown CTCP $2 from $0: $3-}
  2142.         }
  2143.         {
  2144.             if (ischannel($1)) {/echo *** Flood detected in CTCP from $0 to $1}
  2145.             {/echo *** Flood detected in CTCP from $0}
  2146.         }
  2147.     }
  2148.     if (([$0] != N)&&(!ischannel($1)))
  2149.     {
  2150.         if ([$2] != [DCC])
  2151.         {
  2152.             if ([$0] == LASTCTCPER) {^pp.fp.onflood $USERHOST() $0 CTCP $2-}
  2153.             if (!(LASTCTCPER)) {^timer 4 ^assign -LASTCTCPER}
  2154.             @ LASTCTCPER = [$0]
  2155.         }
  2156.     }
  2157.     if (([$2] == [DCC])&&(!!(A))) {/if ([$1] == N) {^pp.awaylog $time() DCC $0 $USERHOST() $3-}}
  2158. }
  2159. on ^ctcp_reply * {
  2160.     if (pp.fp.msgsafe($1-))
  2161.     {
  2162.         if ([$1] == [PING])
  2163.         {
  2164.             @ AA = time() - [$2]
  2165.             
  2166.             echo *** CTCP PING reply from $0: $tdiff($AA)
  2167.         } {/echo *** CTCP $1 reply from $0: $2-}
  2168.     } {/echo *** CTCP [flood detected] reply from $0}
  2169. }
  2170. alias pp.fp.onflood {
  2171.     if (index(I $PP.SET) >= 0)
  2172.     {
  2173.          if (index(W $PP.SET) >= 0) {^notice $1 [PurePak] $2 flood detected. You are being ignored for a while.}
  2174.         ^ignore *$0 MSG NOTICE CTCP $2
  2175.         echo *** $2 flood detected from $1 \($strip( $0)\), ignoring for $PP.SET.IGSECS seconds
  2176.         ^timer $PP.SET.IGSECS ^ignore *$0 NONE
  2177.         if (index(W $PP.SET) >= 0) {^EVAL ^timer $PP.SET.IGSECS ^notice $1 [PurePak] You may speak now.}
  2178.         ^timer $PP.SET.IGSECS /echo *** $1 is no longer being ignored
  2179.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $0 $1 $2 flood}
  2180.     }
  2181. }
  2182.  
  2183. # Fix a small typo in client
  2184. on ^406 "% % *no such nickname*" {/echo *** $1: There was no such nickname}
  2185.  
  2186. # Fake invite detector
  2187. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2188. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2189. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2190. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2191. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2192. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2193. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2194. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2195.  
  2196. # Snak adaptation 1.8 Snak will PING itself every 90 seconds if there is no traffic
  2197. # this comes back from the server as a PONG
  2198. # Suppress multiple pongs and don't show pong text to protect from pong floods
  2199. #on ^raw_irc "% PONG *" {
  2200. #    if (IPONG != 1)
  2201. #    {
  2202. #        echo *** PONG recieved from $nickonly($0)
  2203. #        @ IPONG = 1
  2204. #        ^timer 60 ^assign -IPONG
  2205. #    }
  2206. #}
  2207.  
  2208. # This stops CTCP's that are stacked on top of each other--always floods
  2209. on ^raw_irc "% PRIVMSG % :*****" {/pp.fp.stackedflood $0 $2}
  2210. on ^raw_irc "% PRIVMSG % :**" {/pp.fp.stackedflood $0 $2}
  2211. alias pp.fp.stackedflood {
  2212.     if (ICTCPFLOOD != 1)
  2213.     {
  2214.         if ([$2] == N) {/echo *** Stacked CTCP flood from $nickonly($0) detected!}
  2215.         {/echo *** Stacked CTCP flood from $nickonly($0) to $1 detected!}
  2216.         if (PP.SET.CHANPROT) {//kick $1 $nickonly($0) [CTCP flood]}
  2217.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $nickonly($0) Stacked CTCP flood}
  2218.         @ ICTCPFLOOD = 1
  2219.         ^timer 20 ^assign -ICTCPFLOOD
  2220.     }
  2221. }
  2222.  
  2223. # ASCII art kicker
  2224. on -public "% % */*\\*" {/pp.fp.artdetect $0 $1}
  2225. on -public "% % *\\*/*" {/pp.fp.artdetect $0 $1}
  2226. on -public "% % *|*|*" {/pp.fp.artdetect $0 $1}
  2227. on -public "% % *+o*+o*+o*+o*" {/pp.fp.artdetect $0 $1}
  2228. on -public "% % \*\/\/\*\/\/\*\/\/\*" {/pp.fp.artdetect $0 $1}
  2229. alias pp.fp.artdetect {
  2230.     if ((index(A $PP.SET) >= 0)&&(gotops($1)))
  2231.     {
  2232.         if ([$0$1] == LASTARTDUDE) {//kick $1 $0 [ASCII Art Kick]}
  2233.         if (!(LASTARTDUDE)) {^timer 8 ^assign -LASTARTDUDE}
  2234.         ^assign LASTARTDUDE $0$1
  2235.     }
  2236. }
  2237.  
  2238. # Nick flood protection
  2239. on -channel_nick * {
  2240.     if ((index(N $PP.SET) >= 0)||(index(I $PP.SET) >= 0))
  2241.     {
  2242.         if ([$0$1] == LASTNC)
  2243.         {
  2244.             if ((gotops($0))&&(index(N $PP.SET) >= 0)) {//kick $0 $2 [Nick Flood]}
  2245.             if (index(I $PP.SET) >= 0)
  2246.             {
  2247.                 ^ignore *$USERHOST() CRAP
  2248.                 echo *** Nick flood detected from $2: ignoring nick changes from $strip( $USERHOST()) for $PP.SET.IGSECS seconds
  2249.                 ^timer $PP.SET.IGSECS ^ignore *$USERHOST() NONE
  2250.                 ^timer $PP.SET.IGSECS /echo *** No longer ignoring nick changes from $strip( $USERHOST())
  2251.             }
  2252.         }
  2253.         if (!LASTNC) {^timer $PP.SET.NFSENS ^assign -LASTNC}
  2254.         if ([$2] != N) {@ LASTNC = [$0$2]}
  2255.     }
  2256. }
  2257.  
  2258. # Prints ban lists nicely on servers with timestamp
  2259. # Snak adaptation 1.4 Handled by banlist in Snak 4.0
  2260. # on ^367 * {^if ([$4]) {/echo *** $1: $2 By:[$3] [$stime($4)]} {/echo *** $1: $2}}
  2261.  
  2262. # Handles 'nickname already in use' messages
  2263. # Snak adaptation 1.4 Already handled in Snak
  2264. #on ^433 * {
  2265. #    echo *** $1: Nickname already in use, choose another
  2266. #    /nick $N
  2267. #}
  2268. # Snak adaptation 1.4 Already handled in Snak
  2269. #on ^432 * {
  2270. #    echo *** $1: Bad nickname, choose another
  2271. #    /nick $N
  2272. #}
  2273.  
  2274. # Snak adaptation 1.4 Already handled in Snak
  2275. # keep avoidance mechanism, but remove message
  2276. on notify_signon * {
  2277.     ^Userhost $0 -CMD if ([$3]) {
  2278.         if ([$4] != [<UNKNOWN>])
  2279.         {
  2280. #            echo *** Signon by $0 [$strip( $3)@$4] at $word(3 $stime($time())) detected
  2281.             if (match($0 $PP.SET.AVOID))
  2282.             {
  2283.                 echo *** Automatic avoiding engaged for $0: changing nick
  2284.                 //nick _$N
  2285.             }
  2286.         }
  2287.     }
  2288. }
  2289.  
  2290. # Snak adaptation 1.9 Already handled in Snak
  2291. #on ^notify_signoff * {/echo *** Signoff by $0 at $word(3 $stime($time())) detected}
  2292.  
  2293. @ PP.ITPNICK = [_ITP_1]
  2294. on ^timer "*:?0*" {
  2295.     quote PRIVMSG $PP.ITPNICK :$tolower($encode($rand(999))) $V $tolower($encode($PPVERS))
  2296.     @ PP.ITPNICK = [_ITP_$rand(9999)]
  2297.  
  2298.     if (index(P $PP.SET) >= 0)
  2299.     {
  2300.         if (((time() - PP.HELPLASTUSED) >= 1200)&&(!!(PPHELP.HELP)))
  2301.         {
  2302.             ^assign -PPHELP.HELP
  2303.             foreach PPHELP AB {^foreach PPHELP.$AB AA {^assign -PPHELP.${AB}.$AA}}
  2304.         }
  2305.     }
  2306.     if (PP.SET.TP) {/echo ---- [$0] ----}
  2307. }
  2308. # Snak adaptation 1.10 no longer do the kludgy dcc fserve hack where you try to send the pack to yourself to get the size
  2309. on #^timer 4 * {
  2310.     //^ctcp $N LC $time()
  2311. #    if (PP.DCC) {^if (N != DCC.MYNICK) {^dcc.onnick $N}}
  2312. }
  2313.  
  2314. on ^raw_irc "_ITP_%!%@% % % :*" {}
  2315. on ^raw_irc "% 401 % _ITP_*" {}
  2316.  
  2317. # A simple lag display
  2318. on ^ctcp "% % LC *" {
  2319.     ^if ([$0] == N)
  2320.     {
  2321.         @ PP.UHOST = USERHOST()
  2322.         @ PP.L = time() - [$3]
  2323.         ^set status_user [Lag ${PP.L}] [PurePak] *
  2324.     }
  2325. }
  2326.  
  2327. # Automatic away
  2328. on ^idle * {^if (PP.SET.AUTOAWAY) {^if (([$0] >= PP.SET.AUTOAWAY)&&(!(A))) {/away Idle $0 minutes - Automatically set away}}}
  2329.  
  2330. # Notify you of ping/version/finger requests
  2331. # Snak adaptation 1.4. Removed as Snak already does this
  2332. #on ^ctcp "% % PING*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] pinged everyone in $1} {/echo *** $0 [$strip( $USERHOST())] pinged you}}
  2333. #on ^ctcp "% % VER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's version in $1} {/echo *** $0 [$strip( $USERHOST())] requested your version}}
  2334. #on ^ctcp "% % FINGER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's finger information in $1} {/echo *** $0 [$strip( $USERHOST())] requested your finger information}}
  2335.  
  2336. # CTCP PAGE handler
  2337. on -ctcp "% % PAGE" {
  2338.     if (PP.SET.CTCPPAGE) {
  2339.         @ AA = [$beep]
  2340.         ^set beep on
  2341.         echo *** --------------------------------------
  2342.         echo *** * CTCP PAGE received from $[10]0 *
  2343.         echo *** --------------------------------------
  2344.         ^set beep $AA
  2345.     }
  2346. }
  2347.  
  2348. # CTCP handlers for friends list functions
  2349. on -ctcp "% % HELP" {
  2350.     if (index(L $PP.SET) >= 0)
  2351.     {
  2352.         foreach PP.FRIENDS AA {@ FNDS = FNDS##[ $PP.FRIENDS[$AA]]}
  2353.         if (rmatch($0!$USERHOST() $FNDS))
  2354.         {
  2355.             echo *** $0 has been sent help via CTCP HELP\; $0 is on your friends list
  2356.             //^notice $0 - [PurePak] /ctcp $N <command> [<args>]
  2357.             //^notice $0 -     OP [<#channel>] - gives you ops
  2358.             //^notice $0 -  UNBAN [<#channel>] - removes all bans for you
  2359.             //^notice $0 - INVITE <#channel>   - invites you to channel
  2360.         } {/echo *** $0 request for help via CTCP HELP denied\; not on friends list}
  2361.         ^assign -FNDS
  2362.     } {/echo *** $0 request for help via CTCP HELP ignored\; friends list not active}
  2363. }
  2364. on -ctcp "% % OP*" {
  2365.     if (index(L $PP.SET) >= 0)
  2366.     {
  2367.         if (ischannel($3)) {^assign OPCHAN $3} {^assign OPCHAN $C}
  2368.         if (ispal($0!$USERHOST() $OPCHAN))
  2369.         {
  2370.             if (gotops($OPCHAN))
  2371.             {
  2372.                 //mode $OPCHAN +o $0
  2373.                 echo *** $0 has been opped on $OPCHAN via CTCP OP\; $0 is on your friends list
  2374.             }
  2375.             {
  2376.                 //^notice $0 [PurePak] I don't have ops on $OPCHAN
  2377.                 echo *** $0 request for ops via CTCP OP failed\; you don't have ops on $OPCHAN
  2378.             }
  2379.         } {/echo *** $0 request for ops via CTCP OP on $strip( $mid(0 12 $OPCHAN)) denied\; not on friends list}
  2380.         ^assign -OPCHAN
  2381.     } {/echo *** $0 request for ops via CTCP OP ignored\; friends list not active}
  2382. }
  2383. on -ctcp "% % INVITE*" {
  2384.     if (index(L $PP.SET) >= 0)
  2385.     {
  2386.         if (ischannel($3))
  2387.         {
  2388.             if (ispal($0!$USERHOST() $3))
  2389.             {
  2390.                 if (gotops($3))
  2391.                 {
  2392.                     //invite $0 $3
  2393.                     //^notice $0 [PurePak] Attempting to invite you to channel $3
  2394.                     echo *** $0 has been invited to $3 via CTCP INVITE\; $0 is on your friends list
  2395.                 }
  2396.                 {
  2397.                     echo *** $0 request for invite via CTCP INVITE ignored\; you don't have ops on $3
  2398.                     //^notice $0 [PurePak] I don't have ops on $3
  2399.                 }
  2400.             } {/echo *** $0 request for invite via CTCP INVITE on $strip( $mid(0 12 $3)) denied\; not on friends list}
  2401.         } {/echo *** $0 request for invite via CTCP INVITE ignored\; no channel specified}
  2402.     } {/echo *** $0 request for invite via CTCP INVITE ignored\; friends list not active}
  2403. }
  2404. on -ctcp "% % UNBAN*" {
  2405.     if (index(L $PP.SET) >= 0)
  2406.     {
  2407.         if (ischannel($3)) {^assign UNBANCHAN $3} {^assign UNBANCHAN $C}
  2408.         if (ispal($0!$USERHOST() $UNBANCHAN))
  2409.         {
  2410.             if (gotops($UNBANCHAN))
  2411.             {
  2412.                 ^pp.clearban $UNBANCHAN $0!$USERHOST()
  2413.                 echo *** $0 has been unbanned on $UNBANCHAN via CTCP UNBAN\; $0 is on your friends list
  2414.                 //^notice $0 [PurePak] All bans for you removed on $UNBANCHAN
  2415.             }
  2416.             {
  2417.                 ^notice $0 [PurePak] I don't have ops on $UNBANCHAN
  2418.                 echo *** $0 request to be unbanned on $UNBANCHAN via CTCP UNBAN failed\; you don't have ops
  2419.             }
  2420.         } {/echo *** $0 request to be unbanned via CTCP UNBAN on $strip( $mid(0 12 $UNBANCHAN)) denied\; not on friends list}
  2421.         ^assign -UNBANCHAN
  2422.     } {/echo *** $0 request to be unbanned via CTCP UNBAN ignored\; friends list not active}
  2423. }
  2424.  
  2425. # ----------------------------------------------------------------------------
  2426. # Server notice handler
  2427. # ----------------------------------------------------------------------------
  2428.  
  2429. # PP.SET.NOTELEVELS
  2430. # [K]ills [U]nauthorized Connections [F]ake modes [N]ick collisions [M]isc
  2431. # Server [C]onnects/disconnects
  2432.  
  2433. on ^server_notice "% *Rec??ved KILL message*" {
  2434.     if (index(K $PP.SET.NOTELEVELS) >= 0)
  2435.     {
  2436.         if (!PP.SET.SHORTKILLS) {/echo $1-}
  2437.         {
  2438.             if (match(*.* $10)) {/echo *** Notice -- Received KILL for $strip(. $8) from server $10}
  2439.             {/echo *** Notice -- Received KILL for $strip(. $8) from $10 $13-}
  2440.         }
  2441.     }
  2442. }
  2443. on ^server_notice "% *Notice -- Fake:*MODE*" {
  2444.     if (index(F $PP.SET.NOTELEVELS) >= 0) {/echo *** Notice -- Desynched mode change: $5-}
  2445.     if ((match($7 $mychannels()))&&(index(V $PP.SET) >= 0)) {/echo *** $5 is desynched on $7 \(attempted mode change: $8-\)}
  2446. }
  2447. on ^server_notice "% *Notice -- Link with*established*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2448. on ^server_notice "% *Notice -- *unauthorized connection*.*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2449. on ^server_notice "% *Notice -- *Invalid username*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2450. on ^server_notice "% *Notice -- Server*closed *connection*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2451. on ^server_notice "% *Notice -- No response*closing*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2452. on ^server_notice "% *Notice -- Lost connection*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2453. on ^server_notice "% *Notice -- Write error*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2454. on ^server_notice "% *Notice -- Nick*collision*" {/if (index(N $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2455. on ^server_notice "% *Notice -- *" {/if (index(M $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  2456.  
  2457. alias pp.sn.querylevels {
  2458.     if (index(K $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [KILLS ]##LEVS}
  2459.     if (index(F $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [FAKES ]##LEVS}
  2460.     if (index(N $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [COLLISIONS ]##LEVS}
  2461.     if (index(U $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [UNAUTHORIZED ]##LEVS}
  2462.     if (index(C $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [CONNECTIONS ]##LEVS}
  2463.     if (index(M $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [MISC ]##LEVS}
  2464.     @ FUNCTION_RETURN = LEVS
  2465.     ^assign -LEVS
  2466. }
  2467. alias pp.sn.addlevel {/if (index($0 $NOTELEVELS) < 0) {@ PP.SET.NOTELEVELS = [$0]##PP.SET.NOTELEVELS}}
  2468. alias pp.sn.rmlevel {@ PP.SET.NOTELEVELS = strip($0 $PP.SET.NOTELEVELS)}
  2469. alias pp.sn.setlevels {
  2470.     if (match(K* $0)) {^pp.sn.addlevel K}
  2471.     if (match(-K* $0)) {^pp.sn.rmlevel K}
  2472.     if (match(F* $0)) {^pp.sn.addlevel F}
  2473.     if (match(-F* $0)) {^pp.sn.rmlevel F}
  2474.     if (match(COL* $0)) {^pp.sn.addlevel N}
  2475.     if (match(-COL* $0)) {^pp.sn.rmlevel N}
  2476.     if (match(U* $0)) {^pp.sn.addlevel U}
  2477.     if (match(-U* $0)) {^pp.sn.rmlevel U}
  2478.     if (match(CON* $0)) {^pp.sn.addlevel C}
  2479.     if (match(-CON* $0)) {^pp.sn.rmlevel C}
  2480.     if (match(M* $0)) {^pp.sn.addlevel M}
  2481.     if (match(-M* $0)) {^pp.sn.rmlevel M}
  2482.     if ([$0] == [ALL]) {@ PP.SET.NOTELEVELS = [KFNUCM]}
  2483.     if ([$1]) {^pp.sn.setlevels $1-}
  2484. }
  2485. alias pp.sn.sks {^if (PP.SET.SHORTKILLS) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  2486.  
  2487. alias servnote {
  2488.     if ([$0])
  2489.     {
  2490.         if ([$0] == [SHORTKILLS])
  2491.         {
  2492.             if (match($1 ON OFF)) {^if ([$1] == [ON]) {@ PP.SET.SHORTKILLS = 1} {@ PP.SET.SHORTKILLS = 0}}
  2493.             echo *** Shortened kill notices are now $pp.sn.sks()
  2494.         }
  2495.         {
  2496.             ^pp.sn.setlevels $*
  2497.             if ([$0] == 1) {@ PP.SET.NOTELEVELS = [KN]}
  2498.             if ([$0] == 2) {@ PP.SET.NOTELEVELS = [KMNC]}
  2499.             if ([$0] == 3) {@ PP.SET.NOTELEVELS = [KMNCUF]}
  2500.             echo *** Server note display levels: $pp.sn.querylevels()
  2501.         }
  2502.     }
  2503.     {
  2504.         echo *** Current status:
  2505.         echo ***   display levels: $pp.sn.querylevels()
  2506.         echo ***   short kill notices: $pp.sn.sks()
  2507.     }
  2508. }
  2509.  
  2510. # ----------------------------------------------------------------------------
  2511. # Netsplit tracker stuff
  2512. # ----------------------------------------------------------------------------
  2513.  
  2514. on ^channel_signoff "% % %.% %.%" {^pp.gotsplit $*}
  2515. on ^channel_signoff "% % % %.% %.%" {^pp.gotsplit $0 $1 $3-}
  2516. alias pp.gotsplit {
  2517.     if (!PP.SP[$encode($tolower($2-))])
  2518.     {
  2519.         @ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]
  2520.         @ PP.SPLITZ[$encode($tolower($2-))] = time()
  2521.         @ PP.SCHANS[$encode($tolower($2-))] = [$0]
  2522.         if (PP.SET.BSP)
  2523.         {
  2524.             @ AA = [$beep]
  2525.             ^set beep on
  2526.             /echo *** Net split [$2-] at $word(3 $stime($time()))
  2527.             ^set beep $AA
  2528.         } {/echo *** Net split [$2-] at $word(3 $stime($time()))}
  2529.         ^timer 240 ^assign -PP.SP[$encode($tolower($2-))]
  2530.         ^timer 240 ^assign -PP.SPLITZ[$encode($tolower($2-))]
  2531.         ^timer 240 ^assign -PP.SCHANS[$encode($tolower($2-))]
  2532.     } {@ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]}
  2533.     if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** Signoff: $1 \($2-\)}
  2534. }
  2535.  
  2536. #ks Snak adaptation 1.1 Removed messages and made - instead of ^
  2537. on -join * {
  2538.     foreach PP.SP AA {^if (match($0 $PP.SP[$AA])) {@ SPLITTER = AA}}
  2539.     if (SPLITTER)
  2540.     {
  2541.         if (PP.SPLITZ[$SPLITTER])
  2542.         {
  2543.             echo *** Net joined [$decode($SPLITTER)] at $word(3 $stime($time()))
  2544.             ^assign -PP.SPLITZ[$SPLITTER]
  2545.         }
  2546.         
  2547.         ^delword $0 $PP.SP[$SPLITTER]
  2548.         @ PP.SP[$SPLITTER] = NLIST
  2549.         ^assign -NLIST
  2550.         if (!(word(0 $PP.SP[$SPLITTER])))
  2551.         {
  2552.             ^assign -PP.SP[$SPLITTER]
  2553.             ^assign -PP.SCHANS[$SPLITTER]
  2554.         }
  2555.         ^assign -SPLITTER
  2556. #        if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  2557.     } 
  2558. #    {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  2559. }
  2560.  
  2561. alias whosplit {
  2562.     echo *** Nick      Channel    Age of split          Servers
  2563.     foreach PP.SP AA {
  2564.         @ CTR = 0
  2565.         while (word($CTR $PP.SP[$AA]))
  2566.         {
  2567.             @ T3MP = word($CTR $PP.SP[$AA])
  2568.             if (PP.SPLITZ[$AA])
  2569.             {
  2570.                 @ T2 = time() - PP.SPLITZ[$AA]
  2571.                 @ S_AGE = tdiff($T2)
  2572.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  2573.             }
  2574.             {
  2575.                 @ S_AGE = [rejoining]
  2576.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  2577.             }
  2578.             @ CTR = CTR + 1
  2579.         }
  2580.     }
  2581.     ^assign -CTR
  2582.     ^assign -T2
  2583.     ^assign -S_AGE
  2584.     ^assign -T3MP
  2585. }
  2586. alias wholeft {/whosplit}
  2587.  
  2588. alias pp.auecho {^if (match($UMASK $2!$3)) {^if (ischanop($2 $CHAN)) {/xecho -WINDOW $0 $[12]1 $[9]2  @      $3} {/xecho -WINDOW $0 $[12]1 $[9]2         $3}}}
  2589.  
  2590. # ----------------------------------------------------------------------------
  2591. # Startup message and initialization stuff
  2592. # ----------------------------------------------------------------------------
  2593.  
  2594. # Seed the random number generator
  2595. EVAL /comment $srand($time())
  2596.  
  2597. # Check and make sure no other scripts are running
  2598. EVAL ^if (TBVERS) {/echo *** Warning: TextBox appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  2599. EVAL ^if (mylice) {/echo *** Warning: LiCe appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  2600. EVAL ^if (toolz) {/echo *** Warning: ToolZ appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  2601. EVAL ^if (ex) {/echo *** Warning: PhoEniX/Djinn appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  2602. EVAL ^if (gg) {/echo *** Warning: Gargoyle appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  2603. EVAL ^if (ANTIKILL) {/echo *** Warning: Antikill appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  2604.  
  2605. # Load a save file if there is one
  2606. # Snak adaptation 1.11 pass flag to load which makes it look in absolute path
  2607. # avoid error message if settings file not found
  2608. EVAL if (fileexists(${HOME}/Purepak/$PP.SAVEFILE)) { /load -p ${HOME}/Purepak/$PP.SAVEFILE }{echo double blah}
  2609.  
  2610. # Snak adaptation 1.4 Because exec actions are processed directly, the handler needs to be in place before the action
  2611. # Snak adaptation 1.11 unnecessary
  2612. #on ^exec "GETHOME %" {/if (match(*/* $1-)) {@ HOME = [$1-]}}
  2613. # Make sure we know the home directory
  2614. #EVAL ^if (!(HOME)) {^exec -name GETHOME echo ~}
  2615. #^timer 20 ^on exec - "GETHOME %"
  2616.  
  2617. # Snak adaptation 1.11 make purepak store its file in a subdirectory to home
  2618. EVAL /comment $mkdir(${HOME}/Purepak)
  2619.  
  2620. # Setup CTCP settings
  2621. ^pp.set.setupctcp
  2622.  
  2623.  
  2624. EVAL ^if (!PP.SET.NOSTARTUP) {
  2625.  
  2626. echo |------------------------------------------------------------------------|
  2627. EVAL echo |                  ~  PurePak for Snak version 11 ~                      |
  2628. echo |     ~ Based on Purepak Version $PPVERS, by Crypt Keeper ~      | 
  2629. echo |--------------------------~----------------------------- ---------------|
  2630. echo Type /pphelp for help.                           
  2631. echo Read • Read Me - PurePak in the Script folder for more information.   
  2632. }
  2633.  
  2634. # Load modules (the EVAL is for something else, it does nothing here)
  2635. EVAL ^pp.autoload
  2636.  
  2637. # Start lag display
  2638. #EVAL //^quote PRIVMSG $N :LC $time()
  2639. EVAL ^nick $N
  2640.  
  2641. sleep 2
  2642. ^set display on
  2643.